I want to style my product images depending on product tags (not only the first tag, but all of them).

I am using this:

<img class="<?php echo get_the_term_list( $post->id, 'product_tag'); ?>"

and it is not working, because Woocommerce/Wordpress is styling the product tags as a link.

Help appreciated!


try looking to see if there is css that is causing this issue. Then your code might work. This may just be a specificity issue in your css.

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.