Forums

[resolved] Alternate Sidebar to Link Page Children (2 posts)

  1. 8rittany
    Member
    Posted 3 years ago #

    Okay so I've created a different sidebar (from blog posts) for my Pages and want it to list all pages under a specific Parent Page. The code to use (I think) is:

    <?php get_page_children( $page_id, $pages ) ?>

    So the question: How do I specify the Parent page_id in a sidebar separate from the actual page?

  2. MichaelH
    Volunteer
    Posted 3 years ago #

    Something like:

    <?php
    if ( is_page() ) {
      $page = get_query_var('page_id');
      $children = wp_list_pages('title_li=&amp;child_of='.$page.'&amp;echo=0');
      if ($children) { ?>
        <ul>
        <?php echo $children; ?>
        </ul>
        <?php
      }
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic