Created
January 14, 2016 16:11
-
-
Save JoshRiser/064003ef79b732a4a5b6 to your computer and use it in GitHub Desktop.
Cut to the chase - Get the URL of the featured image, and optionally specify size
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
function the_featured_image_url($post = 0, $size = 'full') { | |
echo apply_filters('the_featured_image_url', get_featured_image_url($post, $size)); | |
} | |
function get_featured_image_url($post = 0, $size = 'full') { | |
$post = get_post($post); | |
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), $size); | |
return apply_filters('get_featured_image_url', $thumbnail[0]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment