Posted By

chrisdpratt on 01/23/10


Tagged

wordpress navigation


Versions (?)

Wordpress Page Sensitive Multi-Level Navigation


 / Published in: PHP
 

URL: http://wphacks.com/page-sensitive-multi-level-navigation/

Display sub-pages of the current page you are on in the left nav and once you hit the bottom of the hierarchy, show pages which are parallel to that page within the same branch of the hierarchy.

  1. <?php
  2. $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&depth=1");
  3. if ($children == "")
  4. $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&depth=1");
  5. ?>
  6. <ul>
  7. <?php echo $children; ?>
  8. </ul>
  9. <?php endif; ?>

Report this snippet  

You need to login to post a comment.