WordPress.org

Ready to get started?Download WordPress

Forums

wp_list_pages list all but top-level parent page (1 post)

  1. fishymusic1
    Member
    Posted 4 years ago #

    I am currently using this code, which is what I want, except that if I am on a grandchild page, it only displays the other grandchildren. I would like to display all the grandchildren and children of a single parent, without displaying the single parent. How can I do that?

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

Topic Closed

This topic has been closed to new replies.

About this Topic