0

I'd like to add a class to tag so that the caption for my featured image will show on hover.

Currently, this is the code when I use FireBug:

<div class="td-post-content">
<div class="td-post-featured-image">
<figure>
<a class="td-modal-image" data-caption="test caption lorem ipsum" href="http://nextwavecities.ph/wp-content/uploads/2015/06/11.jpg">
<figcaption class="wp-caption-text">test caption lorem ipsum</figcaption>
</figure>
</div>
</div>

I'd like to add: <figure class="wp-caption"> , but I don't have any idea which file should I edit. I am unable to find it on any of the PHP files in the theme.

When I upload an image to the blog post, the caption will show on-hover because the figure tag has the "wp-caption" class, except for the featured image.

Any one have an idea?

  • it can be any of these files. single.php, content.php, content-single.php try looking for the_post_thumbnail() or get_the_post_thumbnail() – Karun Jul 1 '15 at 6:22
0
jQuery( document ).ready(function() {    
jQuery("figure").addClass("wp-caption");
});

You could use jQuery to add a class.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.