Quantcast
Channel: User Michael - WordPress Development Stack Exchange
Viewing all articles
Browse latest Browse all 44

Answer by Michael for How to display featured image description and title?

$
0
0

this might work:

$post_thumbnail_id = get_post_thumbnail_id($post->ID);$thumbnail_image = get_posts(array('p' => $post_thumbnail_id, 'post_type' => 'attachment'));if ($thumbnail_image && isset($thumbnail_image[0])) { $img_description = $thumbnail_image[0]->post_content; $img_caption = $thumbnail_image[0]->post_excerpt; $img_alt = get_post_meta($post_thumbnail_id , '_wp_attachment_image_alt', true); $img_title = $thumbnail_image[0]->post_title;}


Viewing all articles
Browse latest Browse all 44

Trending Articles