How to show post format gallery metabox image caption in the post front end

You can add to figcaption on your front-end.

<?php

    if ( !empty( $images ) ) {
        foreach ( $images as $image ) {

           $image_post = get_post($image);
           $caption = $image_post->post_excerpt;

           echo
               '<li class="animated fadeIn">',
                    '<figure>',
                         wp_get_attachment_image( $image, 'post-full-width' ),
                         '<figcaption>', 
                               $caption, 
                         '</figcaption>',
                    '</figure>',
                '</li>';
        }
     }
?>

Leave a Comment