The featured image-related functions do not offer any way to define a default/fallback image. So, you’ll have to define one yourself, e.g.
<?php $featured_image = ( '' != get_the_post_thumbnail() ? get_the_post_thumbnail() : get_template_directory_uri() . '/images/img_not_available.png' ); ?>
<a href="https://wordpress.stackexchange.com/questions/118789/<?php the_permalink(); ?>"><?php echo $featured_image; ?></a>
Edit
Three changes:
- More explicit conditional.
get_the_post_thumbnail()
returns an empty string rather thanfalse
if no image is found. - Updated the default image with yours. Note: use
get_template_directory_uri()
and notget_stylesheet_directory_uri()
. - Cleaned up interspersed PHP/HTML, to help eliminate syntax errors
Note also: example code assumes a context of inside the loop. Modify accordingly if it is used outside the loop.