如何仅向 woocommerce 页面添加功能
我有此代码来删除WooCommerce中的一部分面包屑,该代码在第二个面包屑中说“产品”:
if( $item_position === 2 ){continue;}
虽然它确实有效,但它也可以从其他页面中删除第二个面包屑,而我只希望它将其从中删除WooCommerce,所以我尝试了:
if ( is_woocommerce && $item_position === 2 ){continue;}
它与以前的情况相同,我也尝试过:
if (is_woocommerce ($item_position === 2 ){continue;}
现在可以在我的其他页面上使用,但将完全从WooCommerce中删除面包屑。 我只是在学习,我不知道我在做什么错。
I have this code I put in to remove part of my breadcrumbs in woocommerce which said "Products" in the second crumb:
if( $item_position === 2 ){continue;}
While it does work, it also removes the second breadcrumb from my other pages, while I just want it to remove it from woocommerce so I tried:
if ( is_woocommerce && $item_position === 2 ){continue;}
Which did the same as the previous, and I also tried:
if (is_woocommerce ($item_position === 2 ){continue;}
Which now works on my other pages but will completely remove breadcrumbs from woocommerce.
I'm just learning and I have no idea what i'm doing wrong.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
is_woocommerce()
是一个函数。正确的语法是:
is_woocommerce()
is a function.The correct syntax is: