Created
August 18, 2014 13:01
-
-
Save DWboutin/7c01f1b9c59a4f87b978 to your computer and use it in GitHub Desktop.
Get post thumbnail src
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 | |
// usage: $imageSrc = get_the_post_thumbnail_src(get_the_post_thumbnail( $post->ID, 'medium')); | |
function get_the_post_thumbnail_src($img) | |
{ | |
return (preg_match('~\bsrc="([^"]++)"~', $img, $matches)) ? $matches[1] : ''; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment