Return to Snippet

Revision: 37623
at December 14, 2010 09:31 by martinlucas


Initial Code
<?php
//get current page ID
$the_id = '14';

$args = array(
'child_of'     => $the_id,
'title_li'     => '',
'parent'       => $the_id,
'sort_order'	=> 'DESC',
'sort_column'	=> 'menu_order'
);

$pages = get_pages( $args );

$output = '';

foreach($pages as $value){

	$thumb = get_the_post_thumbnail( $value->ID, array(230,299), $attr = 'class=shopthumbnail' );
	$output .= "<li>";
	$output .= "<a href='" . $value->post_name . "' >" . $thumb . "</a><br />";
	$output .= "<a href='" . $value->post_name . "' >" .  $value->post_title . "</a>";
	$output .= "</li>";
} 

echo $output;
?>

</ul>

Initial URL

                                

Initial Description
Takes the ID of a page, then displays a list of child pages with thumbnails and page titles. The thumbnail is generated from the 'featured image' of the particular child page.

Initial Title
WordPress - Display Child Pages w/ Thumbnails

Initial Tags
php, wordpress

Initial Language
PHP