WordPress.org

Ready to get started?Download WordPress

Forums

Display children of one parent page on home page (1 post)

  1. seancannon
    Member
    Posted 1 year ago #

    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 id="roster-main-profile">  
    
    			<?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
    
    		<div class="roster-main-name"><?php the_title(); ?>
    			</div>	<!-- headlines-title -->
    		</div></a>
    
    		<?php  endwhile; endif; ?>

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

Topic Closed

This topic has been closed to new replies.

About this Topic