How to show grandchildren when on a grandchild page
-
I need help showing the grandchildren of a child page when on a grandchild page.
Here is what I have so far and is working up to that point:
<?php if($post->post_parent) $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0&depth=1'); else $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0&depth=1'); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?>
Here is what I am trying to do:
When on a parent page with child pages: Show children
When on a child page with grandchildren: Show grandchildren
When on a grandchild page: Show grandchildren of above scenarioI’ve been looking all over the forums and on Google and haven’t found anything that will let me do this.
Any help is appreciated.
Thanks!
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘How to show grandchildren when on a grandchild page’ is closed to new replies.