• Resolved wordpressariel

    (@wordpressariel)


    HEllo,

    How can I do to show in the posts, the description and the legend of the featured image, below it?

    Thanks so much for any help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @wordpressariel,

    In order to achieve that you have to create a child theme and add the following code at the end of the functions.php file:

    function get_caption_and_desc_post_image() {
    	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> <div class="image-description">'.$thumbnail_image[0]->post_content.'</div>';
      }
    }
    add_filter( 'neve_before_content', 'get_caption_and_desc_post_image' );
    Thread Starter wordpressariel

    (@wordpressariel)

    Thank you for your help @betydbr i will try it.

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