Support » Themes and Templates » Siblings list with thumbnails

  • Hi,

    Currently I’m using this code:

    	$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
    	$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
    	        if ($children) { ?>
    		<?php echo $children; ?>
    	       <?php } ?>

    to get a list of child pages when on a child page.
    This is now output as an ul with li-items. What I would like is to get the thumbnails for the li-items. My guts tells me I need to do some foreach-loop on the list items, but I’ve got no idea how to do that.
    Hope somebody can help me with this.


Viewing 1 replies (of 1 total)
  • You can list sibling thumbnails like this:

    $child_pages = $wpdb->get_results("SELECT *    FROM $wpdb->posts WHERE post_parent = ".$post->post_parent."    AND post_type = 'page' ORDER BY menu_order", 'OBJECT');
    if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?>
    <div class="overview-image">
    <a href="<?php echo  get_permalink($pageChild->ID); ?>" title="<?php echo $pageChild->post_title; ?>"></a>
    <h2><?php echo $pageChild->post_title; ?></h2>
    <?php echo get_the_post_thumbnail($pageChild->ID, 'overview-thumb'); ?>
    <?php endforeach; endif; ?>


Viewing 1 replies (of 1 total)
  • The topic ‘Siblings list with thumbnails’ is closed to new replies.