FutureMedia
5/31/2014 - 9:46 AM

post_thumbnail_url.php

/**
 * RETORNA URL DO POST_THUMBNAIL PARA BACKGROUND-IMAGE
 * @param 		int: get_the_ID()
 * @param 		string: thumbnail, medium, large, full
 **/
function post_thumbnail_url($post_id, $size = 'thumbnail'){
	$thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $size );
	$url = $thumb[0];
	return $url;
}

/**
 OR in the Loop
 **/
$thumb_id = get_post_thumbnail_id();
$thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail-size', true);
$thumb_url = $thumb_url_array[0];