[wp-hackers] Multi-level page nav

Joel Fisher joelfisher at gmail.com
Sat Aug 1 20:28:56 UTC 2009


I am trying to do this in WP..


Parent 1   PARENT 2    Parent 3

Child 1
Child 2
CHILD 3
 Childlevel3 1
 Childlevel3 2
 Childlevel3 3
Child 4
Child 5


Seems pretty easy with a ..

<?php
 $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
 if ($children) { ?>
  <ul>
  <?php echo $children; ?>
  </ul>
  <?php
 } else {
// your else stuff
 }
?>


However, the kicker here..Child 2 and Child 4 each have third level
childs, but I don't want them to show.

So, I thinking some sort of if else..

<?php
 $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
<?php if (is_page('Child3') || $post->post_parent=="20") : ?>
  <ul>
  <?php echo $children; ?>
  </ul>
  <?php
 } else {
// your else stuff
 }
?>

But I can't seem to get the correct logic in place to ONLY show the
sub-childs of a particular section in-line with the child pages but
not show the other sub-pages third level childs...

Confusing, but an interesting problem. Any suggestions?



joel.fisher
www.flushinc.com

Linkedin: http://www.linkedin.com/in/jfisher
Follow: www.twitter.com/joelmoney


More information about the wp-hackers mailing list