Like AmbitiousAmoeba mentioned, you’ll need to perform a few get_pages
calls to lookup the pages for each child, merge the results together, and iterate over those results.
I worked up an example for you, because it’s fiddly trying to merge arrays when they have matching indexes, the only thing you should need modify are the child_of
parameters, and of course add back in your surrounding HTML..
Updated example
Uses array_merge
instead, i mistaken thought it wouldn’t work for with numeric keys(it does though, as Rarst kindly pointed out in the comments)..
$args = array(
'child_of' => 174,
'sort_column' => 'post_date',
'sort_order' => 'desc'
);
$child_pages = get_pages( $args );
$args['child_of'] = 143;
$second_page_group = get_pages( $args );
$child_pages = array_merge( $child_pages, $second_page_group );
$args['child_of'] = 146;
$third_page_group = get_pages( $args );
$child_pages = array_merge( $child_pages, $third_page_group );
unset( $second_page_group, $third_page_group, $args );
if( !empty( $child_pages ) )
foreach( $child_pages as $_my_page ) {
$title = apply_filters( 'the_title', $_my_page->post_title );
//$content = apply_filters( 'the_content', $_my_page->post_content );
//$content = str_replace( ']]>', ']]>', $content );
$link = apply_filters( 'the_permalink', get_permalink( $_my_page->ID ) );
?>
<div class="thumb-container">
<div class="thumb"><a href="https://wordpress.stackexchange.com/questions/5580/<?php echo $link ?>"> <?php //echo get_image( "thumbnail", 1, 1, 1, $_my_page->ID );?></a></div>
<p class="smalltitle"><?php echo $title ?></p>
</div>
<?php
}
Old example
Might aswell leave the old example in place
// Setup base args for each get_pages call
$args = array(
'child_of' => 174,
'sort_column' => 'post_date',
'sort_order' => 'desc'
);
// Perform the first query to get pages
$child_pages = get_pages( $args );
// Count the results
$c = count( $child_pages );
// Update the child_of arg to another ID
$args['child_of'] = 143;
// Perform the second call to get children pages
$second_page_group = get_pages( $args );
// If there were pages in the first group
if( $c )
// Add them into the first array returned
foreach( $second_page_group as $k => $p ) {
$child_pages[$c] = $p;
$c++;
}
else
// Else fill the array with the results of the second query
$child_pages = $second_page_group;
// Cleanup
unset($second_page_group);
// Count the results again
$c = count( $child_pages );
// Update the child_of arg to another ID before the final get_pages call
$args['child_of'] = 146;
// Make the third call
$third_page_group = get_pages( $args );
// If we have results, add these into that array
if( $c )
foreach( $third_page_group as $k => $p ) {
$child_pages[$c] = $p;
$c++;
}
else
// Else fill the array with the results of the final query
$child_pages = $third_page_group;
// Cleanup
unset($third_page_group);
if( !empty( $child_pages ) )
foreach( $child_pages as $_my_page ) {
$title = apply_filters( 'the_title', $_my_page->post_title );
//$content = apply_filters( 'the_content', $_my_page->post_content );
//$content = str_replace( ']]>', ']]>', $content );
$link = apply_filters( 'the_permalink', get_permalink( $_my_page->ID ) );
?>
<div class="thumb-container">
<div class="thumb"><a href="https://wordpress.stackexchange.com/questions/5580/<?php echo $link ?>"> <?php echo get_image( "thumbnail", 1, 1, 1, $_my_page->ID );?></a></div>
<p class="smalltitle"><?php echo $title ?></p>
</div>
<?php
}
Hope that helps…