简体   繁体   English

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

[英]Product related widget like price slider not working in woocommerce

In my website no product related widget working on theme/woocomerce/archive-product.php. 在我的网站上,没有与主题相关的与widget / woocomerce / archive-product.php相关的窗口小部件。

On the archive product page I write following code: 在归档产品页面上,我编写以下代码:

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

It says 'not shop page'. 它说“不是商店页面”。 I cant figure out what make archive-product not shop page in woocommerce. 我不知道是什么使woocommerce中的存档产品不购物。

You have a documentation regarding Woocommerce conditional tags . 您有有关Woocommerce条件标签的文档。

For archive pages on woocommerce: 对于woocommerce的存档页面:

  • Shop pages: is_shop() 商店页面: is_shop()
  • Product category pages : is_product_category() 产品类别页面: is_product_category()
  • Product Tag pages: is_product_tag() 产品标签页: is_product_tag()

You can test with: 您可以测试:

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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM