Last active
December 12, 2015 09:39
-
-
Save tkjaergaard/4753610 to your computer and use it in GitHub Desktop.
Simple Wordpress snippet to get a post thumbnail url
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
<?php | |
if( !function_exists('get_thumb_url') ) | |
{ | |
function get_thumb_url($size='thumbnail',$id=null) | |
{ | |
$id = ( $id ?: get_post()->ID ); | |
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($id), $size ); | |
return $thumb['0']; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment