• whipd09

    (@whipd09)


    I would like to display 3rd level navigation in my page template, however I can only find the following script:

    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>

    That a) Shows 3rd level at all times (if you’re on 1st or 2nd). I only want it to appear only when you are on the relevant 3rd level page’s parent 2nd level page and any associated peer 3rd level pages.
    b) Once you click through to the 3rd level page the 2nd (and I assume 1st) level navigation disappears.
    Please note: 1st level navigation doesn’t really apply for this problem as it’s outputted separately, horizontally on the top of each page. The 2nd and 3rd is presented in a sidebar format. Please see screenshot for example layout: http://skitch.com/whipd/r3hgw/example

Viewing 1 replies (of 1 total)
  • Did you ever find a solution? I am having almost the same problem with my side navigation, except, the 3rd level seems to work ok, e.g., all of the 3rd level (and lower) navigation disappears except for the active parent, as desired. It just seems to be the 2nd level that shows all sublevels for all items, even non-active ones.

    I am using this before the loop:

    $ancestors = get_post_ancestors($post->ID);
              if( empty($post->post_parent) ) {
                 $parent = $post->ID;
              } else {
                 $parent = end($ancestors);
              }

    and wp_list_pages("title_li=&child_of=$parent&depth=0" );
    in the loop.

Viewing 1 replies (of 1 total)
  • The topic ‘3rd Level Page Navigation’ is closed to new replies.