Featured Image Caption

Hi guys,

I’ve followed your suggestion here https://theme.co/apex/forums/topic/how-can-i-get-the-caption-for-a-featured-image-to-display-in-the-integrity-stack/ and I now have captions displaying under featured images. Thank you. The problem is the appearance. Please take a look at this example https://blogs.themantic-education.com/ibpsych/2018/05/25/can-perceptual-illusions-teach-us-tolerance/. Is there a way I can make the background of the caption white? Also is it possible to have some white space (margin) on the left and right side of the caption?

Thanks!

Jamie

Hi Jamie,

To achieve that, please change this line of code from the code that you have added in your child theme’s functions.php

printf( '<div class="entry-caption">%s</div>', the_post_thumbnail_caption() );

to this

printf( '<div class="entry-caption">%s</div>', get_the_post_thumbnail_caption() );

Then add this in Theme Options > CSS

.entry-caption {
     display:block;
     padding:10px;
     background-color:#fff;
}

In case you want to learn css and how you could customize your site using it. You may watch the videos below.


Thanks

Thanks for the reply Paul. I’ve followed what you wrote but there’s been no change to the appearance of the featured image captions - the captions are still appearing on a transparent background with no padding.

Hi There,

Thanks for writing in!

The given CSS should work. Please try adding this CSS in Theme Option -> CSS

.entry-caption {
     display: block;
     padding: 10px;
     background-color: #fff;
}

Please clear your cache or plugin cache after adding this CSS.

Hope this helps!

Hi Basanta,

Sorry but it’s not working. You can see this in this post (look at the caption under the featured image) https://blogs.themantic-education.com/ibpsych/2018/05/23/an-idea-for-the-next-ib-psych-curriculum/.

I imported this blog from another location. The featured image captions were important on the former blog - often giving credit to photographers. It’d be nice if the X Theme showed featured image captions by default.

Thanks,

Jamie

Hi There,

Thanks for the confirmation!
I am sorry but I can’t find the CSS in your page. Can you confirm if you have added it properly.
Or you can send us your login details in a secure note so that we can have a look.

Thanks

Hi Basanta,

Login details above. Thank you!

Hi There,

Thanks for the details!

upon checking I can see you have added the comment which is the invalid format. That way the CSS was not loading.

The CSS comment should be like /* your comment */
Now I have changed it and it works fine.

Thanks

Thanks so much Basanta!

On behalf of my colleague. You’re welcome.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.