Conditional Tags on Single Product Pages
-
This code from Woocommerce’s website lets you target categories on your website to display messages. The only problem with this is that it does not work on Single Product pages.
I’d like my single product pages to be able to display notes depending on their parent category.
Any ideas?
<?php
if ( is_product_category() ) {
if ( is_product_category( ‘batteries’ ) ) {
echo ‘Testing’;
} elseif ( is_product_category( ‘games’ ) ) {
echo ‘Testing’;
} else {
echo ‘Testing’;
}
}
?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Conditional Tags on Single Product Pages’ is closed to new replies.