views:

39

answers:

1

Hi. Does anyone know how to pull out the url of the image in wordpress so it can be used as a refrence in the script? I need to pull them dynamically. However when I'm using postimage(); it pulls out this:

<a href="address">
<img width="300" height="300" src="image.png" class="image" alt="" title="LINKING"/>
</a>

I'm only interested in src. Does anyone know how to pull it out? Thx in advance

+1  A: 

You can use this code in the loop:

$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID));
echo $thumbnail[0];
windyjonas