Have been searching for an answer to this for a while, have seen lots of answers on various menu solutions but none of them quite deliver what I am loking for.
I am trying to display the child pages and the parent page on a menu within wordpress. So if my site lookslike this:
page 1
page 1a page 1b page 1c
page 2
page 3
page 3a page 3b
page 4
page 5
When on Page 1, I want to show Page 1 and all the child pages below on a menu, when on a child page I want to show the child pages and the parent page on the menu, but not the rest of the pages on the top level.
My current code gets me halfway there as it display all the child pages on any page of the specific branch as it has a specific post id within it, but I don't know what to add to create the parent id. Current code I am using is below:
<ul>
<?php
$children = wp_list_pages('title_li=&child_of='.$post->ID.'820');
if ($children) { ?>
<ul>
<?php echo $children; ?>
</ul>
<?php } ?>
</ul>