I use this to display the featured image for each post. If the post does not have a featured image, a generic image will be displayed:
<?php
if ( has_post_thumbnail() ) {
echo '<a href="' . get_permalink($post->ID) . '" >';
the_post_thumbnail();
echo '</a>';
} else {
echo '<img src="<?php bloginfo('template_directory'); ?>/img/fallback-featured-image.jpg" />';
}
How can I get the fallback image to link to the permalink?