Skip to content

Instantly share code, notes, and snippets.

@cheh
Forked from billerickson/gist:1325306
Created March 11, 2014 21:05
Show Gist options
  • Save cheh/9495077 to your computer and use it in GitHub Desktop.
Save cheh/9495077 to your computer and use it in GitHub Desktop.
<?php
/**
* Display Post Image and Caption
*
* @link http://www.billerickson.net/wordpress-featured-image-captions/
* @author Bill Erickson
*
*/
function be_display_image_and_caption() {
echo '<div class="featured-image">';
the_post_thumbnail();
echo '<span class="caption">' . get_post( get_post_thumbnail_id() )->post_excerpt . '</span>';
echo '</div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment