This snippet gives you the ability to extract the source of the thumbnail image.
It could be needed in a situation where the_post_thumbnail is out of place, which also adds the img tag. The following code creates a variable $image_url which you can use wherever in the document.
This code is meant to be put in an actual WordPress template file, and can be used in different loops, where you want to use the source of the individual thumbnails.
<?php // EXTRACTING THE THUMBNAIL IMAGE SRC. $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id); $image_url = $image_url; ?>