I think this is the easiest solution and the updated one:
<?php the_post_thumbnail('single-post-thumbnail'); ?>
This is the simplest answer:
<?php
$img = get_the_post_thumbnail_url($postID, 'post-thumbnail');
?>
Use:
<?php
$image_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail_size');
$feature_image_url = $image_src[0];
?>
You can change the thumbnail_size
value as per your required size.
You can also get the URL for image attachments as follows:
<?php
"<div><a href=".get_permalink(id).">".wp_get_attachment_url(304, array(50,50), 1)."</a></div>";
?>
<img src="<?php echo get_post_meta($post->ID, "mabp_thumbnail_url", true); ?>" alt="<?php the_title(); ?>" width ="100%" height ="" />
I had searched a lot and found nothing, until I got this:
<?php echo get_the_post_thumbnail_url( null, 'full' ); ?>
Which simply give you the full image URL without the entire <img>
tag.
Hope that can help you.