Search
 
SCRIPT & CODE EXAMPLE
 

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 } ?>
Comment

PREVIOUS NEXT
Code Example
Php :: php pdo delete 
Php :: symfony append to file 
Php :: single sign on php script 
Php :: exit and echo php 
Php :: php pagination ellipsis 
Php :: laravel-check-if-related-model-exists 
Php :: 1 to many relationship in laravel 
Php :: Get the current script file name 
Php :: laravel return from db reorder 
Php :: laravel database engine innodb 
Php :: Route [login] not defined.Route [login] not defined. 
Php :: laravel repository update multiple row 
Php :: how to add files in child theme in theme editor 
Php :: string put inside tag string php 
Php :: php mail() 
Php :: add a snippet in twig shopware 6 
Php :: laravel where condition with if 
Php :: Best documentation tools for php 
Php :: php format phone number with dashes function 
Php :: laravel query builder delete all 
Php :: dompdf php 8 
Php :: delete laravel error log 
Php :: phpmail headers 
Php :: generate a unique id 
Php :: fixing unclosed html tags 
Php :: php monolog 
Php :: laravel api error return homepage 
Php :: XAMPP PHPMyAdmin Access 
Php :: php interview questions for 2 year experience 
Php :: yii2 oauth2 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =