Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Image attribution Reply To: Image attribution

#19721
Tom
Keymaster

You could try something like this:

add_filter( 'post_thumbnail_html', function( $html, $id ) {
    $caption = get_the_post_thumbnail_caption( $id );

    if ( $caption ) {
        return $html . '<div class="featured-image-caption">' . $caption . '</div>';
    }

    return $html;
}, 10, 2 );