Script for adding Woocommerce Img Alt tags

Joined
Dec 17, 2015
Messages
163
Likes
93
Degree
0
So one of my sites is an online gallery and the theme has various sections where it brings product images in dynamically. The trouble is it doesn't provide an option for the alt tag. I see there are a few plugins which automatically add the img alt based on the file name but you have to buy the premium version for it to work with woocommerce images.

I don't mind this too much but is there really much to it or is it just a small script that could be done manually?
 

Ryuzaki

女性以上のお金
Staff member
BuSo Pro
Digital Strategist
Joined
Sep 3, 2014
Messages
3,522
Likes
6,548
Degree
7
I've not messed with WooCommerce that much, but I imagine you could create a child theme and duplicate the template that has the loop for displaying these images. It shouldn't be hard to find the correct functions to do something like, but not exactly <img alt="<?php get_the_title($attachment_ID) ?>" />. Of course I'd have to see the code to know what data is already available in the loop or what extra code would be required. It could be simple or complicated depending on what's already happening with the dynamic images and how they're stored.

Or buy that premium plugin you're talking about.
 
Joined
Dec 17, 2015
Messages
163
Likes
93
Degree
0
Thanks, I'm happy to buy it but figured if it was just a simple line of code then I'd rather not have to stump up the cash or indeed have yet another plugin for it.