Issue 1
The following code will display everything I want except for the main parent title. What do I need to add to the code to display this? For instance if a user clicks on Page this code will display SubPage1, SubPage2, etc. It will not display the main parent page Page.
Issue 2
This code also displays SubSubPages even when the SubPage is not active. I’d like it to only display the SubSubPages when anything in the SubPage is active.
<?php
if($post->post_parent) {
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
$titlenamer = get_the_title($post->post_parent);
}
else {
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
$titlenamer = get_the_title($post->ID);
}
if ($children) { ?>
<h2> <? echo $titlenamer ?> </h2>
<ul>
<?php echo $children; ?>
</ul>
<?php } ?>