Viewing 6 replies - 1 through 6 (of 6 total)
  • AndreeaR

    (@andreearadacina21)

    Hi @viche,

    Thank you for using Neve!

    If you need to display only the caption, try this code snippet:

    function get_caption() {
    	global $post;
         $thumbnail_id    = get_post_thumbnail_id($post->ID);
     	$thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));
      if ($thumbnail_image && isset($thumbnail_image[0])) {
       echo '<div class="image-caption">'.$thumbnail_image[0]->post_excerpt.'</div>';
      }
    }
    add_filter( 'neve_before_content', 'get_caption' );

    Let me know if this helps!

    Thread Starter viche

    (@viche)

    Thanks! I worked perfect!

    AndreeaR

    (@andreearadacina21)

    @viche, you’re welcome!

    We’re glad we could help!

    Thread Starter viche

    (@viche)

    Hi!

    They (image caption) are still visible on pages where the Query Loop Block is used. Is it possible to have the code above visible on posts only?

    Thanks!

    Hi @viche!

    Please replace the code provided above with the one that can be found here and check if it helps to display the caption only on single posts.

    Have a nice day ahead!

    Thread Starter viche

    (@viche)

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Show the caption below the featured image in each post.’ is closed to new replies.