show image caption on the featured image
-
Hi, thanks in advance to those who shall help. I’m going crazy with trying to make the caption of the images visible, at least in the post page (it would be great in the home too). I use wp 4.7.3 with newser theme. I tried by adding this code
if ( ! function_exists( 'the_post_thumbnail_caption' ) ) { function the_post_thumbnail_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])) { return '<div class="front-caption">'.$thumbnail_image[0]->post_excerpt.'</div>'; } else { return; } } }
to the functions.php file of the child theme directory, but it doesn’t work. Onestly I’m not a wp programmer but usually I’m able to get what I want. Any hint? Thanks again
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘show image caption on the featured image’ is closed to new replies.