Calling Subpage Content (3 posts)

  1. dabneymorris
    Posted 7 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
    Posted 7 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...

    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
    Posted 7 years ago #

    I would like to create this kind of Page that lists Sub-Pages this way
    Can anybody help me with this?

Topic Closed

This topic has been closed to new replies.

About this Topic