[Resolved] the_post_thumbnail replaced by default image
I have an issue with a piece of code I’d like to use to be able to show a default image whenever a thumbnail is not defined:
<?php if ( has_post_thumbnail() ) the_post_thumbnail( 'single-post-thumbnail' ); else echo '<img src="default_thumb.jpg" alt="title" title="title" />'; ?>
Problem is, this code snippet returns no image. I tried using
<?php bloginfo('template_directory'); ?>in front of my image but it causes an error. There must be something I am doing wrong here, but I don’t know what.
Anybody could help?
- The topic ‘[Resolved] the_post_thumbnail replaced by default image’ is closed to new replies.