<?php if (has_post_thumbnail( $post->ID ) ): ?>
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
<div id="custom-bg" style="background-image: url('<?php echo $image[0]; ?>')">
</div>
<?php endif; ?>
$img_url = wp_get_attachment_image_url(get_post_thumbnail_id(get_the_ID()), 'full');
<img src="<?PHP echo $img_url?> ">
<?php echo the_post_thumbnail(); ?>
get_post_thumbnail_id($post)
//default
$image_url = wp_get_attachment_url(1234);
// change if post have feature image
if (has_post_thumbnail($recent_post['ID'])) {
$image_url = wp_get_attachment_url(get_post_thumbnail_id($recent_post['ID']), '');
}
<?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 } ?>