Closed. This question is off-topic. It is not currently accepting answers.admin管理员组文章数量:1122846
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 6 years ago.
Improve this questionI want to hide WooCommerce breadcrumb in only WooCommerce archive page. And i want to display it in single product. So i write this code in functions.php:
if(is_shop()) {
remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20);
}
But it not hiding.
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 6 years ago.
Improve this questionI want to hide WooCommerce breadcrumb in only WooCommerce archive page. And i want to display it in single product. So i write this code in functions.php:
if(is_shop()) {
remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20);
}
But it not hiding.
Share Improve this question edited Jul 13, 2024 at 1:53 Nathan Johnson 6,5286 gold badges30 silver badges49 bronze badges asked May 31, 2018 at 21:31 wpdevwpdev 5492 gold badges13 silver badges28 bronze badges1 Answer
Reset to default 3is_shop()
is returning false because the WordPress query isn't set up yet when functions.php
is run. If you attach it to a hook, like wp_loaded
, it should work.
add_action( 'wp_loaded', 'remove_main_content' );
function remove_main_content() {
if( is_shop() ) {
remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
}
}
本文标签: isshop doesn39t work for woocommerce
版权声明:本文标题:is_shop doesn't work for woocommerce 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736300990a1931022.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论