Skip to content

Instantly share code, notes, and snippets.

@jmcclellan
Created August 6, 2013 03:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmcclellan/6161747 to your computer and use it in GitHub Desktop.
Save jmcclellan/6161747 to your computer and use it in GitHub Desktop.
Wordpress: get the post thumbnail URL
<?php
// Use this to retrieve the URL of the featured post thumbnail.
// You can change the 'thumbnail' part to any wordpress image size (eg full, medium, thumbnail, etc.).
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($thumb_id,'thumbnail', true);
echo $thumb_url[0];
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment