How to test If a post has a particular term
I want to display a different description for a post if it belongs to a specific product category in a filter.
I've used the code below code to add the code but it is displaying for all products:
function herara_filter_short_description( $desc ){
global $product;
if ( is_single( $product-id ) ) {
$desc = 'span class=sku_wrapperSKU: span class=sku'. $product-get_sku() .'/span/span/BRspan class=material_wrapperMATERIAL: span class=material'. $product-get_sku() .'/span/span';
}
return $desc;
}
add_filter( 'woocommerce_short_description', 'herara_filter_short_description' );
Topic description shortcode Wordpress
Category Web