Display children of one parent page on home page (WordPress)

So I have a loop that is displaying all pages (not posts) on my home page. I want to modify the loop so that it’ll only display the children of a single parent page (the page id number is 116, just for reference). How should I modify the code below to do this?

<?php query_posts('post_type=page&posts_per_page=-1'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <a href="<?php the_permalink() ?>"
    rel="bookmark"  title="Permanent Link to <?php the_title_attribute(); ?>">
    <div>  

        <?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>

            <div ><?php the_title(); ?>
        </div>  <!-- headlines-title -->

    </div></a>

<?php  endwhile; endif; ?>

Also wanted to add that displaying grandchildren is OK, too…

Related posts

Leave a Reply

2 comments

  1. try this

    <?php query_posts('static=true&child_limit=10&child_of='.$id.'&order=ASC'); ?>
    <?php if(have_posts()) : while (have_posts()) : the_post(); ?>
    <a href="<?php the_permalink();?>"><?php the_title();?>:</a><?php the_excerpt(); ? >
    <?php endwhile; endif; ?>
    

    $id is your page id

  2. Changed course and got the results I wanted this way:

    <?php
    $pages = get_pages('child_of=129&sort_column=post_date&sort_order=desc');
    $count = 0;
    foreach($pages as $page)
    {
    $content = $page->post_content;
    ?>
    
    
    <a href="<?php echo get_page_link($page->ID) ?>" >
        <div >  
    
    
            <?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
    
        <div><?php echo $page->post_title ?>
            </div>
        </div></a>
    
    
    
    <?php } ?>