如何在侧边栏小部件中修改和设置WooCommerce产品类别计数NUMBER

问题描述 投票:0回答:1

好的,所以我找到了一种方法来修改'woocommerce_subcategory_count_html'以便像在functions.php中那样在主页中对类别计数进行修改,并在CSS中对其进行样式设置。这是一张图片,显示我的意思:

add_filter('woocommerce_subcategory_count_html', 'filter_woocommerce_subcategory_count_html', 10, 2);

function filter_woocommerce_subcategory_count_html($mark_class_count, $category)
{
    $mark_class_count = ' <mark class="count">' . $category->count . '</mark>';
    return $mark_class_count;
}

enter image description here

但是,我找不到在产品页面侧栏中的产品类别计数编号执行相同操作的方法:

enter image description here

我们在每个类别的右边都有类别和计数。我想删除方括号并设置计数数字的样式。

我曾尝试爬网为例,但找不到侧边栏类别列表特有的内容。

这可能吗?

[如果有人有任何想法可以找到解决此特定问题的解决方案,将不胜感激。

谢谢。

php css wordpress woocommerce
1个回答
0
投票

您可以在主题文件夹的function.php文件中使用此钩子

© www.soinside.com 2019 - 2024. All rights reserved.