obțineți url-ul imaginii recomandate în wordpress
if ( has_post_thumbnail()) {
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');
echo '<a href="' . $large_image_url[0] . '">';
the_post_thumbnail('thumbnail');
echo '</a>';
}
arată imaginea prezentată în post wordpress
<?php if(has_post_thumbnail()){
the_post_thumnbail('cstm_name', array( 'class' => 'class1 class2' ))
} else { ?>
<img class="card-img-top" src="http://placehold.it/750x300" alt="Card image cap" class="img-responsive">
<?php } ?>
wordpress recomandate imagine arată
<?php echo the_post_thumbnail(); ?>
wordpress a prezentat imaginea ca imagine de fundal
<?php
if ( has_post_thumbnail() ) {
$image_b1 = get_the_post_thumbnail_url();
}
else {
$image_b1 = get_stylesheet_directory_uri().'/images/noimage.png';
}
?>
<div style="background-image: url(<?php echo $image_b1; ?>);">