listing child pages (4 posts)

  1. vickyh
    Posted 8 years ago #

    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

    $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) { ?>
    <?php echo $children; ?>
    <?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?

  2. sunburntkamel
    Posted 8 years ago #

    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.

  3. depperson
    Posted 7 years ago #

    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!

  4. depperson
    Posted 7 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic