• I would like to display in a PHP sidebar (using the PHP Code widget) the children of the currently displayed code. I’ve tried examples from the codex
    http://codex.wordpress.org/Template_Tags/wp_list_pages
    but what they consistently do is display children of the home page rather than those of the current page.

    For instance

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

    (My only change was to add depth=1 since I don’t want the entire “web-map”, just the proper children of this page.)

    Any thoughts?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Displaying child pages in sidebar’ is closed to new replies.