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开发者_StackOverflow社区 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
You can use this code in the loop:
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID));
echo $thumbnail[0];
精彩评论