• I’m using a static home page and have another page for displaying the list of blog posts. I also have some static pages as subpages of the main blog page.

    I’ve used the code

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

    in the sidebar file to display a list of sub pages. It’s working fine on every single page in the site, except on the blog page. Nothing shows up at all. So i can’t then get to the sub pages of the blog.

    What have I done wrong?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Amie

    (@sunburntkamel)

    unfortunately wordpress doesn’t know what page the blog page is (basically, it’s the home page, not a page)

    it’s best to just set the child_of to match your blog page’s ID. you can use is_home() to run different subpage code on the blog page.

    i use some really complex code to do it on my own site. it’s a pain.

    Just bumping this post for a similar question:

    I use the them Amazing Grace theme found in the WP themes directory.
    I have my pages listed at the top, but I would like the Tabs (just below the site name) to show as the the child pages respectively.

    Any place to start?

    BTW: I am a rank amateur when it comes to coding, but if you can give me the path to take, I can cut my way through it!

    The coding that vickyh used works wonderfully in my site – with one exception: HOW CAN I LIMIT IT TO ONE-SUBLEVEL?

    When I click on a sub-page, if they also have sub-pages, then THEY show up in the tabble menu.

    I have tried the depth=1 or depth=2 to no avail. Any help?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘listing child pages’ is closed to new replies.