In my theme I want to display the featured image, but I also want to display the title attribute (of the image, not of the post/page) beside the image itself.

Is there a simple way to do this? Where should I be looking?

Thanks,
John.

4 s
4

post_excerpt is actually the caption attribute. Here is the correct answer:

$title = get_post(get_post_thumbnail_id())->post_title; //The Title
$caption = get_post(get_post_thumbnail_id())->post_excerpt; //The Caption
$description = get_post(get_post_thumbnail_id())->post_content; // The Description

Leave a Reply

Your email address will not be published. Required fields are marked *