Check for the Post Thumbnail

The Post Thumbnail is an image that you select to represent your posts content. Generally it’s the small thumbnail image you see beside a posts excerpt.


[php]
<?php global $post ?>

<!– Check if a Post Thumbnail has been assigned –>
<?php if ( has_post_thumbnail() ) : ?>

<?php //Create image attributes
$img_atts = array(
‘alt’ => trim( strip_tags( $post->post_title ) ),
‘title’ => trim( strip_tags( $post->post_title ) ),
‘class’ => ‘thumbnail’,
);
?>

<div class="image-holder">
<?php echo get_the_post_thumbnail( $post->ID, ‘thumbnail’, $img_atts ) ?>
</div>
<!– / .image-holder –>

<?php endif; ?>
[/php]