产品相关的小部件,如价格滑块在 woocommerce 中不起作用

Product related widget like price slider not working in woocommerce

在我的网站上,theme/woocomerce/archive-product.php.

上没有与产品相关的小部件

在存档产品页面上,我写了以下代码:

if(is_shop()){
echo 'shop page'; 
} else{
echo 'not shop page'; 
}
exit;

它说 'not shop page'。我无法弄清楚是什么使存档产品不是 woocommerce 中的商店页面。

您有关于 Woocommerce conditional tags 的文档。

对于 woocommerce 上的存档页面:

  • 商店页面:is_shop()
  • 产品类别页面:is_product_category()
  • 产品标签页:is_product_tag()

您可以测试:

if ( is_shop() ) {
    echo 'Shop page'; 
} elseif ( is_product_category() ) {
    echo 'Product category page'; 
} elseif ( is_product_tag() ) {
    echo 'Product Tag page'; 
} else {
    echo 'not an archive page'; 
}
exit;