Is there a WordPress PHP code to call an image Caption, Alternative Text, and Decription? I have several images with Titles, captions, alt text and Description fields filled and would like to display these on the image.
I know how to call the image title:
<h1><?php the_title(); ?></h1>
How to do so with the other fields?
Here’s a sample of the rest of my code (this is for a slideshow)
<div class="slide">
<?php if ( get_post_meta( $post->ID, "slide_url_value", $single = true ) != "" ): ?>
<a
href="<?php echo get_post_meta( $post->ID, " slide_url_value ", $single = true ); ?>"
title="<?php the_title(); ?>">
<?php the_post_thumbnail( 'featured-slide', array( 'title' => get_the_title() ) ); ?>
</a>
<?php else: ?>
<?php the_post_thumbnail( 'featured-slide', array( 'title'=>get_the_title() ) ); ?>
<?php endif; ?>
<h1><?php the_title(); ?></h1>
</div>
Is there a way to use <?php the_field(''); ?>
or id slugs?
WordPress stores image (attachment) data as follows:
post_content
fieldpost_excerpt
field_wp_attachment_image_alt
meta valueAnd in code, that translates to: