have_posts()):?>
have_posts()) : $related_query->the_post(); ?>
-
ID, 'related-thumbnail', array( 'title' => $title, 'alt' => $title ) );
}
else {
$attachments = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'numberposts' => 1 ) );
if ( count( $attachments ) > 0 ) {
$img = array_shift( $attachments );
$img = wp_get_attachment_image( $img->ID, 'related-thumbnail', true );
}
}
$extra_class = '';
if ( $img == '' ) {
$img = wp_html_excerpt( get_the_excerpt(), 40 );
$extra_class = ' related-thumb-text';
}
?>