i rocks technology
i rocks technology

Reputation: 39

Woocommerce - add CSS class to image in Shop Page

I want to add some custom class to img tags and after each img tag I want to add a span tag, so please let me know in which file I can find the shop page img tags.

For more details please have a look at below tag from the shop page:

<img width="300" height="222" src="http://testxone.com/tank-sanitizer/wp-content/uploads/2020/06/hand-sanitizer-300x222.jpg" class="attachment-woocommerce_thumbnail size-woocommerce_thumbnail" alt="">

Look at the screenshot for more details:

screenshot

Thanks.

Upvotes: 1

Views: 608

Answers (1)

Always Helping
Always Helping

Reputation: 14570

Try this to add class to your img tags and append a span as you wanted.

Add Class to img tag

$('.attachment-woocommerce_thumbnail').addClass('custom-class')

Add span to you img tag

$('.attachment-woocommerce_thumbnail').append('<span class="my_span">My Custom Span</span>')

Hope this helps.

Upvotes: 1

Related Questions