• bcreighton

    (@bcreighton)


    Hi,

    I am using an If, Else structure that checks to see if there are subpages for the current page and adds a subnav to my sidebar. I can get it to work perfectly until I click on the third or more level in – then the nav disappears. This is the logic I have:

    <?php if (is_page(9)) { ?>
        <li><a class="current_page_parent" href="/index.php?page_id=9">Who</a>
          <?php } else { ?>
        <li><a href="/index.php?page_id=9">Who</a>
          <?php } ?>
          <!--check for Who (ID = 9) subpages-->
          <?php if (is_page(9) || $post->post_parent=="9") {
    if($post->post_parent)
    $children = wp_list_pages("sort_column=post_date&title_li=&child_of=".$post->post_parent."&echo=0"); else
    $children = wp_list_pages("sort_column=post_date&title_li=&child_of=".$post->ID."&echo=0");
    if ($children) { ?>
          <ul>
            <?php echo $children; ?>
          </ul>
          <?php } } ?>
        </li>

    Any ideas? Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter bcreighton

    (@bcreighton)

    For example, something like:

    <?php if (is_page(9) || $post->post_parent=="9" || $post->$post->post_parent=="9")

    but obviously the third post part is wrong. just not sure how to write that logic…

    Thread Starter bcreighton

    (@bcreighton)

    Or…

    if (is_page(11) || $post->post_parent=="9"|| $post->post_parent->post_parent=="9")

    but that’s not right either. bah!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Showing Sub Sub nav for current Page’ is closed to new replies.