Last active
August 29, 2015 14:10
-
-
Save niksudan/e96378a6320e6c4b8c38 to your computer and use it in GitHub Desktop.
Get post thumbnail URL [WordPress]
This file contains 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
<?php | |
/** | |
* Get post thumbnail URL | |
* | |
* @param string $size | |
* @return string | |
*/ | |
function get_thumbnail_url( $size = 'thumbnail' ) | |
{ | |
global $post; | |
$url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $size ); | |
return $url ? $url[0] : false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment