• Hi, I’m using this code block from Official WordPress documentation, to add featured image into a post:

    add_filter( 'the_content', 'featured_image_before_content' );
    
    function featured_image_before_content( $content ) {
        if ( is_singular('post') && has_post_thumbnail()) {
            $thumbnail = get_the_post_thumbnail();
    
    <p><?php echo get_post(get_post_thumbnail_id())->post_excerpt; ?></p>
    
            $content = $thumbnail . $content;
    
    		}
    
        return $content;
    }

    This works perfectly fine, but how do I modify the code so that the image caption (or the credits line) appears below the image?

    TIA.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Image credits (caption) below featured image’ is closed to new replies.