Matthew Pateman Matthew Pateman - 1 year ago 83
PHP Question

Wordpress <?php the_post_thumbnail( 'full' ); ?> without the img-tag

I have noticed that using the post_thumbnail() function in Wordpress inserts the image including the img-tag. Is there a way to have it insert ONLY the src of that image?

Sofar i have tried this

$image = get_the_post_thumbnail( $post->ID, 'thumbnail' ); echo $image;

but it just exports the same.
Any ideas? thanks in advance for your help :)

Answer Source

Found answer. Thanks anyway.

//Get the Thumbnail URL
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array(320,240), false, '' );
echo $src[0];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download