WordPress.org

Ready to get started?Download WordPress

Forums

How to only show children of Pages? (4 posts)

  1. indigowhite
    Member
    Posted 9 years ago #

    I wish to have a site with pages and subpages. How do I make so the top Pages only show up in the index, and when you click on a Page, only show the children of that page?

    I've searched a lot for a answer to the question, but I can't find any. Please someone, take your time to explain to me, please please

  2. prissed
    Member
    Posted 9 years ago #

    I did the same thing on my site. Here's what I did.

    On my sidebar I did this:

    <ul>
    <?php wp_list_pages('depth=1&title_li=<h2>' . __('Pages') . '</h2>' ); ?>
    </ul>

    Then I got the php-exec plugin, and on each top-level page, I used this code:

    <ul>
    <phpcode>
    <?php
    wp_list_pages('child_of=9&title_li=');
    ?>
    </phpcode>
    </ul>

    Where the "9" in 'child of=9' is the page id number of each top-level page.

    I don't know if there are other ways to do this (I'm sure there are), but this was the easiest way for me. :)

  3. alastc
    Member
    Posted 9 years ago #

    That looks like a good way of doing it within wordpress' artitechture, but I wanted something a bit more dynamic. I put something together that was an included file in the sidebar, described here:
    http://wordpress.org/support/topic.php?id=29412

  4. starflyer3000
    Member
    Posted 8 years ago #

    @prissed:

    I wanted to let you know that I tried your suggestion on my site and it looks like it will work perfectly. Thanks!

    duane

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.