the_post_thumbnail replaced by default image
-
Hi!
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?
Thanks!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘the_post_thumbnail replaced by default image’ is closed to new replies.