-
-
Save FutureMedia/4e02d9c9be5ac0bac48a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment