Tagged: enfold, Images, Lightbox, woocommerce
Hi guys,
I upgraded a client site to Enfold 2.9.2 and WordPress 4.0, and now the image titles in WooCommerce are no longer displaying.
It looks like previously, the Image Title or Caption would display in the lightbox for each image, but now the Description is the only thing that is displayed (and I don’t have descriptions in any of the 2,000+ images in this site).
Is there something that I could add to my funcitons.php to use the Title as opposed to the Description for the lightbox?
Thanks,
John
Hi,
Try adding this at the very end of your theme / child theme functions.php file:
function add_custom_script(){
?>
<script>
(function($){
$(window).load(function() {
$(".single-product-main-image .images img").each(function(){
var $this = jQuery(this), theAlt = $this.attr('alt');
$this.parent().attr('title', theAlt);
});
});
})(jQuery);
</script>
<?php
}
add_action('wp_footer', 'add_custom_script');
Regards,
Josue
Thanks Josue – that worked perfectly!
I appreciate the assist.
John