Last active
February 21, 2016 03:52
-
-
Save marushu/0fdc4a2d1df16fce3c22 to your computer and use it in GitHub Desktop.
Get post thumbnail image's 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 | |
if( has_post_thumbnail() ) { | |
$thumbnail_id = get_post_thumbnail_id( get_the_ID() ); | |
$image_obj = wp_get_attachment_image_src( $thumbnail_id, 'full' ); | |
echo '<pre>'; | |
print_r( $image_obj[0] ); | |
echo '</pre>' . "\n"; | |
$image_url = esc_url( $image_obj[0] ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment