WordPress.org

Support

Support » How-To and Troubleshooting » wp-list-page to list only subpages of one particular page

wp-list-page to list only subpages of one particular page

  • Hi!

    I have got an issue building up my navigation menu: I’d like to have a menu listing only subpages of one particular page, and also display the children pages of all pages I display.

    <?php wp_list_pages( 'title_li=&include=484,486,488,490,492,494,496' ); ?>

    I managed to have them displayed by using the include arg, that was easy, but then I dont manage to have the children of these pages to show up.

    Would any of you have an idea about how to do that?
    If my question is not clear enough, do not hesitate to ask for more details, I will try to explain again!

    Thanks!

Viewing 1 replies (of 1 total)
  • I keep looking around, and this code seems to be like the beginning of something… will try to understand it, but if somebody could help, I’d be gratful! 🙂

    <?php
    $output = wp_list_pages('echo=0&depth=1&title_li=<h2>Top Level Pages </h2>' );
    if (is_page( )) {
      $page = $post->ID;
      if ($post->post_parent) {
        $page = $post->post_parent;
      }
      $children=wp_list_pages( 'echo=0&child_of=' . $page . '&title_li=' );
      if ($children) {
        $output = wp_list_pages ('echo=0&child_of=' . $page . '&title_li=<h2>Child Pages</h2>');
      }
    }
    echo $output;
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘wp-list-page to list only subpages of one particular page’ is closed to new replies.
Skip to toolbar