custom page template help
-
let’s use this scenario:
parent page namedMUSIC (music.php)
child page of MUSIC named DANCE (music_dance.php)
child page of DANCE named THEORY (music_dance_theory.php)Now… when a user clicks MUSIC, all child pages display (current code to display the child page DANCE):
<?php wp_list_pages('child_of=77&sort_column=post_title&title_li=&depth=1') ?>
and… when DANCE is clicked, all child pages display (current code to display the child page THEORY):
<?php $children = wp_list_pages('sort_column=post_title&title_li=&child_of='.$post->ID.'&echo=0'); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?>
Question: As you can see, i created a separate php template file for each instance. Is there a way to only create 1 simple template that will work for this scenario? a single php template just for the parent pages?
Reason: The reason i ask is because i plan on having 60 parent pages, all with 30+ children, and then those children will have 30+ children. I do not want to create 180 page templates.
Any help is appreciated…
P.S. When clicking the parent page (MUSIC) the only results i want displayed are the child page titles and not the children of the 1st level child page.
- The topic ‘custom page template help’ is closed to new replies.