WordPress.org

Ready to get started?Download WordPress

Forums

Calling Subpage Content (3 posts)

  1. dabneymorris
    Member
    Posted 5 years ago #

    I'm using WP as a CMS for my client and have set up an about page. In that about page, I've set up 3 subpages that are individual staff bios. I know how to call the content of a page, but I need to dynamically call all the subpages of my about page, and return their content so I can display them dynamically.

    I'm NOT trying to list the subpages with wp_list_pages function. I don't want links to the pages, I want the actual pages.

    I'm not doing posts as categories for the sake of the client. I want to keep the layout very simple. So they can edit the staff pages as a subpage of the about page.

    all I really need is to return each subpage's ID to an array.

    Any suggestions?

  2. nikz
    Member
    Posted 5 years ago #

    I had a similar requirement, just figured it out.

    You can put your subpages into an array thusly...
    $subpages = get_pages("child_of=".$post->ID);

    Then echo the subpage and column you need like so...
    _e($subpages[0]->post_content);

    Add this to your page template and just substitute 'post_content' with the required column. Wrap the echo in a for or while loop to give the client a way to add/remove employees by simply creating/deleting subpages.

    I used this technique to provide a client a way of giving pages different sidebar content for each page.

  3. byandreasdotcom
    Member
    Posted 5 years ago #

    I would like to create this kind of Page that lists Sub-Pages this way
    http://stephanieizard.com/?q=cook
    Can anybody help me with this?

Topic Closed

This topic has been closed to new replies.

About this Topic