simcoweb Posted July 6, 2018 Share Posted July 6, 2018 Greetings. I'm using the Divi theme from Elegant Themes for a new magazine style project. The theme does not display the caption for any of its image related modules and the featured image that displays in the posts as the thumbnail does not. We need the caption to display for legal reasons since it will attribute the source of the image. Here's the code they use for their theme display in the single.php file: } else if ( ! in_array( $post_format, array( 'gallery', 'link', 'quote' ) ) && 'on' === et_get_option( 'divi_thumbnails', 'on' ) && '' !== $thumb ) { print_thumbnail( $thumb, $thumbnail["use_timthumb"], $titletext, $width, $height ); echo wp_kses_post(get_post(get_post_thumbnail_id())->post_excerpt); } else if ( 'gallery' === $post_format ) { et_pb_gallery_images(); } Basically this is a custom function instead of using the standard Wordpress function. I searched around the Wordpress plugin repository and found someone who posted this code as a possible fix: <div class="et_post_meta_wrapper"> ... <?php if (get_post(get_post_thumbnail_id())->post_excerpt) { // search for if the image has caption added on it ?> <div class="featured-image-caption"> <?php echo wp_kses_post(get_post(get_post_thumbnail_id())->post_excerpt); // displays the image caption ?> </div> <?php } ?> </div> <!-- .et_post_meta_wrapper --> The problem is, where he says to insert this (just before the closing </div> tag for the wrapper, ) the caption displays at the bottom of the page, not underneath the featured image. I'm thinking that this code can be adapted to the same section of the code I posted above so that it all works as one unit in summoning the thumbnail and the caption. However, my PHP skills are not up to speed in order to conjure up the correct syntax for merging these two. Any help would be greatly appreciated. Thanking everyone in advance! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.