• Resolved antoniomanco

    (@antoniomanco)


    Hi, How can I do to visualize the “image caption” in the featured images of my post.

    I try the code below in functions.php, but the “image caption” is seen in post and pages, but I just want it to be seen in post.

    Thanks

    add_action( 'generate_after_entry_header', 'db_featured_image_caption', 15 );
    function db_featured_image_caption() {
        $get_description = get_post(get_post_thumbnail_id())->post_excerpt;
        if(!empty($get_description)){    
            echo '<span class="featured_caption">' . $get_description . '</span>';
        }
    }
    • This topic was modified 4 years, 3 months ago by antoniomanco.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘“image caption” only in post’ is closed to new replies.