Product categories widget – hide specific category
-
Hi,
I would like to hide specific category/categories from the product categories widget, which I have in sidebar. I do not want to use any plugin. I prefer css. Thank you. 🙂
-
Hi @martinus09!
Since custom coding is outside our scope of support, I am leaving this thread open for a bit to see if anyone can chime in to help you out.
Searching, I found a couple of articles with code that could be helpful. Please take a look at them for pointers:
* https://www.businessbloomer.com/woocommerce-hide-non-current-categories-product-categories-widget/
* https://www.businessbloomer.com/woocommerce-hide-non-current-categories-product-categories-widget/
* https://wordpress.stackexchange.com/questions/192051/hide-specific-categories-from-category-widget
If you aren’t familiar with adding custom code to your site, here is some information as to how to do it. We recommend using the free Code Snippets plugin to easily add code to your site without editing the PHP file.
I hope this helps!
Hello @martinus09,
Could you provide your site URL Please? So that I can look into this.
Cheers
Naz.Hi @nazreenexe
For sure. Here you are.
http://www.superbicykel.sk
and the sidebar you can find here
https://www.superbicykel.sk/shop/For example, I would like to definitely not display category called: “X_NEZOBRAZOVAT” (the last one).
Via CSS I can disable just whole widget. I am not able to get into it.
Hello @martinus09,
This might be difficult to do just with css as the filters are plain links. Instead you could use plugin like this to precisely control what needs to be shown and not.
Cheers
Naz.Actually nothing works for me. This one from Juan looked promising, but no.
https://wordpress.stackexchange.com/questions/192051/hide-specific-categories-from-category-widget
If I want to use this:
//Hide categories from WordPress category widget function exclude_widget_categories($args){ $exclude = "1,4,8,57,80"; $args["exclude"] = $exclude; return $args; } add_filter("widget_categories_args","exclude_widget_categories");After the $exclude I should write categoryID? In my case $exclude = “1478”;
Right?
-
This reply was modified 4 years, 6 months ago by
martinus09.
Hi @martinus09
That’s correct! However, you may need to use the legacy Product category widget to make it work.
AFAIK, there’s no hook with the new Product Category widget.
So, you can install the Classic Widget plugin, and then try the codes above within that!
If it doesn’t work, you can visit the WooCommerce Facebook group or the
#developerschannel of the WooCommerce Community Slack.We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.
My very best,
I have managed my problem using plug-in called “Hide Categories Or Products On Shop Page”. It is working fine, done exactly what I wanted. But I am no really a big fan of plug-in when it is not necessary.
Hi @martinus09!
That’s great! Glad to hear you found a solution.
Thank you for sharing it with everyone 🙂
If you want a code-related solution, you could visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack as recommended by @chiape. You can open a thread there with your request, and the community of developers that hangs there will guide you in the right direction.
Also, you can get in touch with one of the customization experts listed on the WooCommerce Customizations Page; they can create any customization you want.
Cheers!
-
This reply was modified 4 years, 6 months ago by
The topic ‘Product categories widget – hide specific category’ is closed to new replies.