WordPress.org

Ready to get started?Download WordPress

Forums

list ALL child pages (5 posts)

  1. OffLead
    Member
    Posted 8 years ago #

    Is there a way to list all child pages, regardless of the parent ID? Barring that, is there a good way to retrieve all the parent IDs in order to list them each out within the php, without having to hard-code the IDs into the templates?

    I've got a handful of top level pages without parents, and some of them will have child pages. I need to be able to list them all out without their parents if possible.

  2. Christopher J. Hradil
    Member
    Posted 8 years ago #

    whree do you want to "list" them, they should show up in the default site navigation menu, under "pages" check out the code used for that, then use it where you need it. i only have two pages at the moment (not including posts), but for an example see http://www.hradil.us on the right site, under pages, that's a list of ALL the pages I've created so far for the top level of the site.

  3. OffLead
    Member
    Posted 8 years ago #

    I don't want all pages listed. Let's say my page structure is thus:

    PAGES:
    - Contact Us
    -- Sub Contact A
    -- Sub Contact B
    -- Sub Contact C
    - About Us
    -- Sub About A
    -- Sub About B
    - Another Page
    -- Sub Another A
    -- Sub Another B
    -- Sub Another C

    What I want to accomplish is a menu that reads like this:

    -- Sub Contact A
    -- Sub Contact B
    -- Sub Contact C
    -- Sub About A
    -- Sub About B
    -- Sub Another A
    -- Sub Another B
    -- Sub Another C

    I don't want the "parent" pages, only the child pages. I know how to display the child pages of a known parent (child_of=$id), but I don't want to have to code this in for each parent page whenever I add or remove one. I would like to simply pull ALL child pages, of all the parent pages, whatever they happen to be.

  4. Christopher J. Hradil
    Member
    Posted 8 years ago #

    first, check: http://codex.wordpress.org/Template_Tags
    then take a look at: http://codex.wordpress.org/Plugin_API

    between the template tags and hooks/filters you should be able to come up with something close to what you're looking for

  5. OffLead
    Member
    Posted 8 years ago #

    Might be able to if I could make heads or tails out of that second link. ;-)

    Okay, so this might be beyond my abilities to do.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.