Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

echo placeholder image if post thumbnail not found

<?php if ( has_post_thumbnail()) {
  the_post_thumbnail($post->ID);
  } else { ?>
  <img class="post-placeholder-img" src="https://via.placeholder.com/300" alt="<?php the_title(); ?>" />
<?php } ?>
Source by wordpress.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #echo #placeholder #image #post #thumbnail
ADD COMMENT
Topic
Name
1+7 =