在wooCommerce中的[最近_products]短码中排除类别
我们有一个在WooCommerce上运行的POS系统,我们用于instore购买。这意味着我们有一个不在网上销售的项目类别。我有一个插件,可成功地从前端隐藏这些类别和相关的产品,但是由于某种原因,当我们使用[最近的_products]短代码时,这不会影响该项目显示。
我试图屠杀短代码以隐藏此特定类别,但是这些项目仍然显示:
[recent_products per_page="4" order="desc" cat_operator="NOT IN" category="instore"]
使用最近的产品的短码,这甚至可以使用吗?是我可能缺少某些东西,还是有其他方式可以显示新产品并排除类别“ instore” - instore 是类别slug,顺便说一句,完整类别名称仅为 instore instore
这已经困扰着我一段时间了。
任何建议都将是最欢迎的。
此致 唐娜
We have a POS system running on woocommerce which we use for instore purchases. This means we have a category for items that we do not sell online. I have a plugin which succesfully hides these categories and associated products from the front end but this does not affect the items display when we use the [recent_products] shortcode for some reason.
I've attempted to butcher the shortcode to hide this specific category but the items still show:
[recent_products per_page="4" order="desc" cat_operator="NOT IN" category="instore"]
Is this even possible using the recent product's shortcode? Am I maybe missing something or is there another way I can display new products and exclude the category 'instore' - instore is the category slug, by the way, the full category name is Instore only
This has been troubling me for a while now.
Any suggestions will be most welcome.
Best Regards
Donna
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
现在您想将其隐藏在短代码中,为什么不尝试此Quy:
只需将其添加到您的主题的
function.php
之前,请在结束?>
或如果functions.php
没有?>
只需在最后一行之后添加它,然后让我们看看它是否可以做什么。Now that you want to hide it from shortcodes, why dont we give this quy a try:
just add this to your theme's
functions.php
right before the ending?>
or if thefunctions.php
doesnt have?>
just add it after the last line and lets see if it does what it should do.仅使用
最近的_products
短代码就不可能...需要在woocommerce_shortcode_products_querys_query
带有一些PHP代码的过滤中挂钩。尽管我认为您可以使用products
这样的快捷代码来实现自己想要的东西:更多示例在这里: https://woocommerce.com/document/woocommerce-shortcodes/#scenario-4-newest-products
It's not possible with the
recent_products
shortcode alone... would need hook into thewoocommerce_shortcode_products_query
filter with some PHP code. Though I think you can achieve what you want with theproducts
shortcode like this:More examples here: https://woocommerce.com/document/woocommerce-shortcodes/#scenario-4-newest-products