Last active
October 3, 2016 11:28
-
-
Save thesadoo/d2d9aa8b38702b4818dbd6596d451fdd to your computer and use it in GitHub Desktop.
Wordpress post thumbnail URL
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 | |
function ThumbnailAddress( $id = false, $echo = true, $size = "fullsize" ) { | |
global $post; | |
if( !$id ){ | |
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), $size ); | |
} else { | |
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($id), $size ); | |
} | |
if( $echo == true ){ | |
echo $thumb['0']; | |
} else { | |
return $thumb['0']; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment