• Resolved brm-dev

    (@brmecham)


    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:

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

    That’s from: https://codex.www.ads-software.com/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?

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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.

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

    Let me know if it worked for you.

    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.

    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!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘in WP 2.8 – Child Pages Template no longer works’ is closed to new replies.