• 0
Sign in to follow this  
Followers 0

How to display a caption to featured image?

Question

Posted · Report post

Is there an easy hook to display a featured image with caption (on the blog page)? add something like : <?php the_post_thumbnail(); echo ....? Thank you

Share this post


Link to post
Share on other sites

5 answers to this question

  • 0

Posted · Report post

I don't think you need external coding for this. - when you insert an image into a post, fill in the "Caption" field - and just to the right of the "Insert into Post" button, click the "Use as Featured Image" link Post back if you're looking for something else.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

No. This works only for the images inside the post but not for featured Images (at least with PlatFormPro). I really think that I'll need to add some PHP in the template.postloop.php Someone could help with code to add? Thank you

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

It worked Thank you Adam!

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

i tried adding the code function the_post_thumbnail_caption() { global $post; $thumb_id = get_post_thumbnail_id($post->id); $args = array( 'post_type' => 'attachment', 'post_status' => null, 'post_parent' => $post->ID, 'include' => $thumb_id ); $thumbnail_image = get_posts($args); if ($thumbnail_image && isset($thumbnail_image[0])) { //show thumbnail title echo $thumbnail_image[0]->post_title; //Uncomment to show the thumbnail caption //echo $thumbnail_image[0]->post_excerpt; //Uncomment to show the thumbnail description //echo $thumbnail_image[0]->post_content; //Uncomment to show the thumbnail alt field //$alt = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); //if(count($alt)) echo $alt; } } from the wordpress forum post mentioned above to the bottom of my functions.php file. as you may be able to tell, i'm a prrty skanky hack who's just guessing for now. anyway, couldn't get the captions to display on the featured image thumbnails.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0