Quantcast
Channel: Vijayakumar Blog » WordPress Tips
Viewing all articles
Browse latest Browse all 9

echo the_post_thumbnail url [Solved]

$
0
0

This article tells how to echo the value of URL of the image which defined as <?php the_post_thumbnail() ?>.

So far,  <?php the_post_thumbnail() ?> executes the complete image. But, most of them required to echo the only URL. Below code will echo the value of the URL of the image.

<?php echo wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) );?>

or

<?php
//Get the Thumbnail URL
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 720,405 ), false, ” );
echo $src[0];
?>


Viewing all articles
Browse latest Browse all 9

Trending Articles