Forums

Parent of a Parent (1 post)

  1. chrismoncus
    Member
    Posted 3 years ago #

    SO I have a custom navigation structure that worked great with only two levels. Now that I have a third level problems have risen.

    Here's the code.

    <div id="main_nav">

      <?php wp_list_pages('sort_column=menu_order&title_li=&depth=1'); ?>

    </div>
    <div id="sub_nav">

      <?php
      if($post->post_parent) { // page is a child
      wp_list_pages('sort_column=menu_order&title_li=&child_of='.$post->post_parent);
      } elseif(wp_list_pages("child_of=".$post->ID."&echo=0")) { // page has children
      wp_list_pages('sort_column=menu_order&title_li=&child_of='.$post->ID);
      }
      ?>

    </div>

    Now, how can I tell the second level to only show the second level? It shows the third level when on the third level.

Topic Closed

This topic has been closed to new replies.

About this Topic