作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
在 WooCommerce 中,我的类别列表页面和产品列表页面是从 archieve-product.php 呈现的(默认情况下)。如何检查functions.php 中的页面是否为is_shop()?因为 is_shop 函数在 functions.php 中不起作用。我只是想从类别列表中删除我的侧边栏页面,而不是从产品列表页面中删除。
最佳答案
当放置在钩子(Hook)中时,is_shop
将在 functions.php 中工作
add_action( 'template_redirect', 'custom_template_redirect' );
function custom_template_redirect() {
if( is_shop() ) :
// code logic here
endif;
}
这是所有 WooCommerce conditionals 的列表
关于php - WooCommerce 如何检查 functions.php 中的页面是否为 is_shop()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37350704/
你能帮我解决下面的代码吗?我需要隐藏特定类别的价格,但在商店和类别页面上,而不是在产品详细信息或管理上。 我需要添加 is_product_category() 和 is_shop() 代码,但不知
在 WooCommerce 中,我的类别列表页面和产品列表页面是从 archieve-product.php 呈现的(默认情况下)。如何检查functions.php 中的页面是否为is_shop()
我是一名优秀的程序员,十分优秀!