【问题标题】:Removing or customizing drop-down sorting menu for woocommerce for specific product-category为特定产品类别删除或自定义 woocommerce 的下拉排序菜单
【发布时间】:2017-01-30 03:58:06
【问题描述】:

我想删除产品排序或自定义一个特定产品类别的排序选项,而不影响我网站上所有其他页面/类别的排序。

我找到this question;我已将代码添加到functions.php,但我不确定下一步该做什么。

我想要么删除“按价格排序”,而只有“按 A-Z 排序”和“按 Z-A 排序”或完全删除排序。

假设产品类别的名称是“BrandABC”。因此,在我的网站上,网址将如下所示:
http://www.mywebsite.com/product-category/brandABC/

我在编辑产品类别时发现该页面有以下内容:

taxonomy=product_cat&tag_ID=13&post_type=product......

我已尝试将其放入主题的自定义 CSS 中:

.product_cat .id-13 .woocommerce-ordering {
    display: none;
}

也试过了:

.product_cat&tag_ID=13 .woocommerce-ordering {
    display: none;
}

都没有用。如何仅识别和定位 BrandABC 页面?

【问题讨论】:

  • 感谢您的回复。 .term-13 除了 .term-brandabc 工作之外什么也没做。感谢您的帮助!

标签: php css wordpress woocommerce


【解决方案1】:

在产品类别存档页面中,WooCommerce 在 body 标签如 term-your-cat-slugterm-your-term-ID

例如,如果您的产品类别名称是:Example Category,并且它的 slug 是 example-category,术语 ID 是 10;然后 WooCommerce 将在 body 标签中添加以下类

term-example-category term-10

因此,您可以将以下任何 CSS 代码添加到您的活动主题 style.css 或子主题 style.css

.term-brandabc .woocommerce-ordering{
    display: none;
}

替代 CSS(推荐):

.term-13 .woocommerce-ordering{
    display: none;
}

希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 2021-07-05
    • 2018-07-07
    • 1970-01-01
    • 2018-11-09
    • 2013-08-11
    • 1970-01-01
    • 2016-08-06
    • 1970-01-01
    相关资源
    最近更新 更多