JustPaste.it

Caption Featured Images

I have added the following at functions.php:

 

 // featured image caption

function the_post_thumbnail_caption_desc() {
  global $post;
 
  $thumbnail_id    = get_post_thumbnail_id($post->ID);
  $thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));
 
  if ($thumbnail_image && isset($thumbnail_image[0])) {
    echo '<span class="tdb-caption-text">'.$thumbnail_image[0]->post_excerpt.'</span>';
  }
}

 

Then at the plugin that is responsible for the styles, here is what I updated.

 td-standard-pack/Newspaper/parts/single/single_template_7.php

 

<?php the_post_thumbnail_caption_desc(); ?>

 

(I added it to the other meta data.)


And for styling, I added the following to CSS:

 

.tdb-caption-text {
  color: #ffff8f;
  float: right !important;
}