Edit product content based on category
-
We are using Google Translate to automatically translate our website but we want to exclude products in a certain category. We already accomplished that for some products by placing the
<span class="notranslate">Span</span>
tag manually in the product descriptions and in the respective template files but now we want to do that for a larger quantity of products so we think using a hook would be a better way.I want to achieve something like follows but I don’t know how to correctly insert the NoTranslate span only for the product description:
add_action( 'wp', 'disable_translation' ); function disable_translation() { // If a product in the 'Cookware' category is being viewed... if ( is_product() && has_term( 'Cookware', 'product_cat' ) ) { //... Wrap the product description into notranslate span to disable the translation <span class="notranslate">???????????????????</span> } }
Could anybody kindly tell me how to do this? Thanks a lot!
The page I need help with: [log in to see the link]
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Edit product content based on category’ is closed to new replies.