Wordpress 隐藏特定自定义分类类别中的div

Wordpress 隐藏特定自定义分类类别中的div,wordpress,css,categories,taxonomy,custom-taxonomy,Wordpress,Css,Categories,Taxonomy,Custom Taxonomy,我正在处理网站页面,它属于婚礼类别,属于一个名为listing的自定义分类法。在我的婚礼类别列表中,我不想显示价格标签,但它应该显示在所有其他列表帖子中,例如 我试过了 if ( in_category( 'wedding' )) { ?><style>.pricestricker{display:none!important;}</style><?php }?> if(属于“婚礼”类别){ ?>.pricestricker{显示:无!重要;} 也

我正在处理网站页面,它属于婚礼类别,属于一个名为listing的自定义分类法。在我的婚礼类别列表中,我不想显示价格标签,但它应该显示在所有其他列表帖子中,例如

我试过了

if ( in_category( 'wedding' )) {
?><style>.pricestricker{display:none!important;}</style><?php
}?>
if(属于“婚礼”类别){
?>.pricestricker{显示:无!重要;}

if(属于“婚礼”类别){
?>.pricestricker{显示:无!重要;}

if(有_术语('listing','widding')){
?>.pricestricker{显示:无!重要;}

这些都不起作用。请帮助。谢谢

请在出现div“pricestricker”的地方尝试一下:

<div class="pricestricker" <?php if ( in_category( 'wedding' )) { echo 'style="display:none;"' }?>><span itemprop="price" class="wlt_shortcode_price">$0</span></div>
Here you should only write the php code inside the div "pricestricker" and remain will be default code.

$0//这将是您的默认代码
您知道“pricestricker”div出现在哪一页上吗?如果是,请尝试下面给出的答案
if ( has_term('listing', 'wedding' )) {
?><style>.pricestricker{display:none!important;}</style><?php
}?>
<div class="pricestricker" <?php if ( in_category( 'wedding' )) { echo 'style="display:none;"' }?>><span itemprop="price" class="wlt_shortcode_price">$0</span></div>
Here you should only write the php code inside the div "pricestricker" and remain will be default code.
   <?php if ( !in_category( 'wedding' )) { ?>
            <div class="pricestricker"><span itemprop="price" class="wlt_shortcode_price">$0</span></div> // This will be your default code
   <?php } ?>