Child Pages Question
-
I’m using the following code to pull in data from child pages into my parent page:
<?php $mypages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=asc'); foreach( $mypages as $page ) : setup_postdata($page); ?> <div class="item"> <div class="thumbnail"><a href="<?php echo get_page_link($page->ID) ?>"><?php echo get_the_post_thumbnail($page->ID, 'full', array('alt' => $page->post_title, 'title' => $page->post_title));?></a></div> <h1><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?> >></a></h1> <p><?php echo(get_post_meta($page->ID, excerpt, true)); ?></p>
This works fine. However I have added another level of child pages to the mix.
So here’s a map:
Parent -> Child -> Grandchild
The parent page is now pulling in data from child & grandchild pages when I run the code above in my page template.
Is there a way to force the code to check only and child and not the “grandchildren” as well?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Child Pages Question’ is closed to new replies.