I'm displaying a featured image (as a background) in a hero div, and using the caption to add some content from the Media Library automatically. I'd also like to use the image's description field and title, but can't find documentation on that. Here's what I have so far, which works as expected:
<div class="hero"> <?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );?> <div class="hero-image" style="background-image: url('<?php echo $thumb['0'];?>')"></div> <div class="hero-content"> <h1>NEED IMAGE DESCRIPTION HERE</h1> <p class="caption"><?php get_the_post_thumbnail_caption(); ?><?php the_post_thumbnail_caption(); ?></p> </div> </div>
I'm not sure if I'm already getting that info, but not echoing it...or if I need to do more to get it from the database. Thanks in advance for your help!