How to alter this custom text, so it will only be shown in one specific category, let's say: ONLY in category: tables?
add_action( 'woocommerce_after_shop_loop_item', 'show_meer_varianten_loop', 100 );
function show_meer_varianten_loop() { ?>
<div >✓ Meer varianten</div>
<?php
}
in css:
.products .product:not(.product-type-variable) .custom-label-variable {
display: none;
}
CodePudding user response:
You are using WooCommerce so check your body classes. There should be some class that references that category like category_tables or term-01.
You can manage your CSS like this:
body:not(.category_tables) .products .product:not(.product-type-variable) .custom-label-variable {
display: none;
}
It's not the best option, but it's a quick and effective solution for those who don't know how to work with WP Functions.
CodePudding user response:
Try this..I think it works ..
add_action(
'woocommerce_after_shop_loop_item',
'show_meer_varianten_loop', 100 );
function show_meer_varianten_loop()
{
global $product;
if ( has_term( 'tables',
'product_cat', $product->ID ) ) { ?>
<div >✓ Meer varianten</div>
<?php
}
}