• Hi,

    Currently I’m using this code:

    <?php
    	if($post->post_parent)
    	$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
    	else
    	$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
    	        if ($children) { ?>
    		<ul>
    		<?php echo $children; ?>
    		</ul>
    	       <?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.

    Cheers
    Michael

Viewing 1 replies (of 1 total)
  • Nic-O

    (@nic-o)

    You can list sibling thumbnails like this:

    <?php 
    
    $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'); ?>
    </div>
    <?php endforeach; endif; ?>

    Cheers!
    -Nic

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