Can anyone help?
I'm trying to show a default placeholder image on my posts when the user hasn't uploaded an image.
I have the below code BUT i need to rewrite it so that the link isn't applied to the placeholder image - only the uploaded image.
Unfortunately my PHP isn't great at all so would appreciate some help..
<div class="imageContainer"><a href="<?php the_permalink(); ?>">
<?php
// Must be inside a loop.
if ( has_post_thumbnail() ) {
the_post_thumbnail('size-2');
}
else {
echo '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/images/shared/placeholder.jpg" />';
}
?>
</a></div>