• Any thoughts on getting this plugin to work with the Divi theme? I can get it to display the caption in any site using the Divi theme.

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi Steven. Did you ever find a way to get Divi to show captions on featured images? I’m not having any luck with this either. Thank you.

    Hello,

    I am also using Divi and this plugin didn’t work but I found an easy way to add the caption below the featured image. You should have a child theme set up, with the single.php file copied over from the parent Divi theme.

    1. Open the single.php file from your child theme
    2. Paste the following code before the closing et_post_meta_wrapper div:

    <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 -->

    3. Make sure to add your caption to the image in your media library

    You can then style the caption by targeting the “featured-image-caption” class.

    Hope that helps!

    • This reply was modified 6 years, 4 months ago by sidrarubel.

    Hi, I tried your code snippet but it didn’t work. No caption displays. I inserted this directly in front of the closing div tag as directed but it displayed the caption at the very bottom of the page, not underneath the featured image.

    This code could work but I think it needs to be repositioned and modified to work around line 64 in the single.php which is where the code for displaying the featured thumbnail is. Please advise.

    Hi simco,

    There are actually two divs in this file with the “et_post_meta_wrapper” class. You need to make sure you put it at the end of the first one, just before the <div class=”entry-content”> area.

    I’m using Divi version 3.7, so in my single.php file I added this on line 118, but it may be different with different versions of Divi.

    Hope that helps!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Plugin Doesn’t Work With Divi Theme?’ is closed to new replies.