WordPress.org

Support

Support » How-To and Troubleshooting » How to only show children of Pages?

How to only show children of Pages?

  • 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

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

    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

    starflyer3000

    @starflyer3000

    @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

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to only show children of Pages?’ is closed to new replies.
Skip to toolbar