Show Image 'Title' in WooCommerce Image PopUp

I’m using WooCommerce for an online catalog. The Featured Image of the product is set to popup with image info (the main image). The downside is that it shows the ‘ALT’ info. on the top. I want the ‘Title’ info. to be on the top.

Is there a way to do this within a function?

Is that lightbox that shows the feature image part of the WooCommerce plugin or an extension of it? If so, you could revise that code, but you need to do it in a copy of woocommerce (see http://code.tutsplus.com/articles/an-introduction-to-theming-woocommerce-for-wordpress--wp-31577) placed in your theme directory. You should not touch the WooCommerce plugin itself.

One solution could be to use JavaScript to replace the text with the value of the title attribute. If you decide to go that route, I’m sure some of the JavaScript experts here would be happy to guide you.

The image popping up comes from ‘product-thumbnails.php’, which is in woocommerce.

echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '<a href="%s" class="%s" title="%s" data-rel="prettyPhoto[bxgallery]">%s</a>', $image_link, $image_class, $image_caption, $image ), $attachment_id, $post->ID, $image_class );

Obviously ‘title’ isn’t posting the actual title from the Media’s Meta. It’s posting the ‘Alt text’ from the Media’s Meta, and that’s wrong. So I guess the idea is to find the source script to fix this problem.

But when you find it on the source script, don’t change it there. Copy that file into a woocommerce directory inside your theme and make the changes there. That way you will be able to update the plugin to a new version without losing your changes.

Yes, which is why I created my own folder in my own theme.

So now I’m having difficulty understanding how to adapt the Meta ‘Title’ in the popup image.

Anyone?

If not, please bump to where I can receive assistance.

I’ve attached the jquery.prettyPhoto.min.js file that controls the display of the info.

jquery.prettyPhoto.min.zip (9.1 KB)

I’m sorry, @toad78. I’ve been swamped with work and other things the past few days. Would you like me to move the thread to the JavaScript forum to see if you can get some help there?

By the way, the link to your .js file does not seem to be working for me.

Yes, please! I’ve modified my message above and uploaded a .zip file.

Okay, your thread is now in the JavaScript section. Unfortunately I’m not much of a JavaScript expert. I hope you will be able to get some help here.

Thank you.

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