Return to Snippet

Revision: 55657
at February 16, 2012 02:38 by dloop


Initial Code
<?php global $wp_query;
     $post = $wp_query->post;
     $ancestors = get_post_ancestors($post);
     if( empty($post->post_parent)) {
          $parent = $post->ID;
     } else {
          $parent = end($ancestors);
     }
     if(wp_list_pages("title_li=&child_of=$parent&echo=0")) { ?>
     
     <ul>
          <?php wp_list_pages("title_li=&child_of=$parent&depth=0"); ?>
     </ul>
<?php } ?>





.children {display: none}

.current_page_item ul.children,
.current_page_ancestor ul.children,
.current_page_parent ul.children {display: block}

Initial URL

                                

Initial Description
Yes this works, needs css ...

Initial Title
Wordpress: 3rd Level Navigation, Show 2nd & 3rd Level Navigation Together

Initial Tags

                                

Initial Language
PHP