Forums

query_posts and get content for children of a page (3 posts)

  1. desmondo
    Member
    Posted 1 year ago #

    Hi all, I'm having trouble finding an answer to this, so if you can send me a link or tell me, I'd be really happy...

    I'm trying to print out the content of several pages in a loop. I want to target all the children of a page called "voluntary-sector"

    Here is my line of code, but can't figure out what I should change:

    <?php query_posts('pagename=the-work/voluntary-sector'); ?>

    Would appreciate any advice.
    Cheers

  2. desmondo
    Member
    Posted 1 year ago #

    To elaborate, I have tried the page_parent thing and it doesn't work. Is there a way to display content in a loop according to the page parent?

    <?php if (have_posts()) : ?>
    <?php query_posts('pagename=the-work/voluntary-sector/breast-cancer-campaign&showposts=5&sort_column=post_date'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <li><?php meta('thumbnail-graphic'); ?></li>
    <?php endwhile; endif; ?>

    The page "breast-cancer-campaign" is one of the children of the parent page "voluntary-sector". Rather than just grab the individual page, I would like to grab all the child pages of "voluntary-sector".

    Any help would be great, I stil can't find the answer.

  3. desmondo
    Member
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags