I’m currently using this code (per the codex) to show children on parent pages, and children of the parent pages on their children:
<?php if($post->post_parent)
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
else
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children) { ?>
<ul>
<?php echo $children; ?>
</ul>
<?php } ?>
I would like to add that if on a secondary child page (child’s child) to then show it’s parent and parent’s siblings.
Thank you for your help! 😀
This will check if the post has a parent and then if that post has a parent. The
$page_listshould be a list of pages of the parent and its siblings. the'depth' => 1tells WordPress to only get one level of pages. This will stop it from getting the children of those pages