Posted By

dloop on 02/16/12


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

adeg


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


 / Published in: PHP
 

Yes this works, needs css ...

  1. <?php global $wp_query;
  2. $post = $wp_query->post;
  3. $ancestors = get_post_ancestors($post);
  4. if( empty($post->post_parent)) {
  5. $parent = $post->ID;
  6. } else {
  7. $parent = end($ancestors);
  8. }
  9. if(wp_list_pages("title_li=&child_of=$parent&echo=0")) { ?>
  10.  
  11. <ul>
  12. <?php wp_list_pages("title_li=&child_of=$parent&depth=0"); ?>
  13. </ul>
  14. <?php } ?>
  15.  
  16.  
  17.  
  18.  
  19.  
  20. .children {display: none}
  21.  
  22. .current_page_item ul.children,
  23. .current_page_ancestor ul.children,
  24. .current_page_parent ul.children {display: block}

Report this snippet  

You need to login to post a comment.