[resolved] in WP 2.8 - Child Pages Template no longer works (4 posts)

  1. brmecham
    Posted 7 years ago #

    I upgraded to WordPress 2.8. Now my Child Pages template doesn't correctly list the child pages.

    I made a custom page template that uses code straight from the WP Codex:

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

    That's from: http://codex.wordpress.org/Template_Tags/wp_list_pages

    In 2.7.1 that child pages template worked fine, which made it so when I was viewing the parent page it would show a list of all child pages.

    For some reason now it just shows a list of my Blogroll!!!

    Any ideas on how to make this work in 2.8?

  2. BVBAccelerate
    Posted 7 years ago #

    Hey, not sure if this is exactly what you were looking for, but I had to do the same thing to my site. The following code worked for me. It shows the child pages, and if it is on the last child it will show all of the pages of the parent page. I had to combine two different kinds of old code, it's not the prettiest but gets the job done.

      global $id;
      global $post;
      $navpages = wp_list_pages("title_li=&child_of=$id&depth=1&echo=0");
         echo $navpages;
      } else {

    Let me know if it worked for you.

  3. MichaelH
    Posted 7 years ago #

    I had no problem using the code listed by brmecham at 2.8 using the WordPress Default theme, putting the code in a Page template inside The Loop.

  4. Monika
    Posted 7 years ago #

    the original code from codex doesn't work for me too,
    if in the loop or outside -nothing ;-)

    but your code works like a charme @BVBAccelerate

    thanks a lot!

Topic Closed

This topic has been closed to new replies.

About this Topic