The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

How do I show a pages sub-pages in WordPress

  • # June 30, 2009 at 2:45 pm

    As stated in the post’s topic, i was wondering if someone knew how to list sub-pages of a page within the same page. For example, I would like a page named products to list a bunch of products by a certain company, and when more products are added as a sub-page of the products page, the list gets updated to reflect the change. I’m there’s a single wp tag that would do this, so please forgive my stupidity for not knowing this.

    Many thanks in advance for your help.

    # June 30, 2009 at 2:54 pm

    The best place to start is always the codex

    This is what you are looking for

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

      < ?php echo $children; ?>

    < ?php } ?>

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed