Display a parents children works but problem when viewing a child page
-
Good afternoon all.
I have a slight problem with one of my “Page” templates. I am creating a site in WordPress with the intention of using it for its CMS rather than blogging needs. I will not need to use posts and the whole site will be made using pages.
That being said the pages are grouped into parents and children. so for example i have:
– About Us (parent)
– Vision, Mission and Values (child)
– Contact Us (child)
– Careers & Employability Staff (child)As part of a custom page template i have created there is a section on the left that displays the child pages. This works fine when viewing the About Us page and the links work correctly navigating you to the child page. However when you then go on that child page the list disappears as i would expect because they have no children they are the children.
What i need is to modify my code to display the fellow children. My code looks like this
<div id="leftNavContainer"> <?php $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0'); if ($children) { ?> <div class="leftNavInnerContainerHeader"><?php echo get_the_title($ID); ?> </div> <div id="leftNavInnerContainerBody"> <ul> <?php echo $children; ?> </ul> </div> <?php } ?> </div>
I hope i have explained myself well enough
Any help would be thankful
- The topic ‘Display a parents children works but problem when viewing a child page’ is closed to new replies.