Show parent while on child page
-
I use the following code to display a sub menu on each page that has sub pages. However, when I am on one of the child pages, the parent level seems to disappear, how can I keep the parentlevel while on a child page?
CODE:
<?php if($post->post_parent) $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&depth=4"); else $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=1&depth=4"); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?>
This is a picture to show how it looks when you are on a parent page with the sub menu open.
https://dev.worldwaterweek.org/wp-content/uploads/2009/08/on_parent_page.JPG
This picture shows how the sub menu displays while being on a child page, the parents are not visible.
https://dev.worldwaterweek.org/wp-content/uploads/2009/08/on_child_page.JPG
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Show parent while on child page’ is closed to new replies.