Home › Forums › WoodMart support forum › Hide categories from category loop
Hide categories from category loop
- This topic has 7 replies, 2 voices, and was last updated 2 weeks, 3 days ago by
Hung Pham.
-
AuthorPosts
-
September 17, 2025 at 12:12 pm #686784
hofitdParticipantHi
I use the Product Categories Elementor element to show the categories.
I have some categories that I need to hide or show manually.The best way for me to achieve it, is to add an ACF field to the category edit page, so that the website owner can click this button to decide if hw wants to show or to hide this category.
The problem is – that the categories loop code doesn’t contain any data on the specific categoty – such as term id, slug or special css classes I want to add.
How can I add a special class to the loop element based on the selected value of the acf field?
these are the exiting classes:
wd-col category-grid-item wd-cat cat-design-alt without-product-count wd-with-subcat product-category productThank you
HofitSeptember 18, 2025 at 6:29 pm #687074
Hung PhamParticipantHi hofitd,
Thanks for reaching to us and appreciate your patience.
You can use Custom CSS to hide specific categories by using the ID, let me know your decision.
Regards,
Hung PDSeptember 21, 2025 at 9:04 am #687375
hofitdParticipantHello
there is no ID in the code.
see attached screenshot.Attachments:
You must be logged in to view attached files.September 22, 2025 at 8:27 am #687440
Hung PhamParticipantHi hofitd,
Thanks for your patience.
You can use
data-loop
attr, for e.x:.wd-cats .product-category[data-loop="11"]{ display: none; }
Regards,
Hung PDSeptember 25, 2025 at 10:37 am #688026
hofitdParticipantHi
data loop is the order of the items on the page, so in case I will change the categories order – it will hide categories that should be displayed, just becuase the order is changed.
I can’t use this solution or any byilt-in solution. This is why I contacted you, since there is no unique ID or class to any of the elements.What I need is a manual ability to hide and show specific categories (by using ACF field).
Can you please let me know how can I use any kind of hook in my child theme’s functions.php file, to add a unique css class to the category item ?Thank you
HofitSeptember 26, 2025 at 6:35 am #688126
Hung PhamParticipantHi hofitd,
Unfortunately, you requests require customization and out of our basic support. Thanks for understanding our limitations.
Regards,
Hung PDSeptember 26, 2025 at 7:10 am #688131
hofitdParticipantHi
I am not asking you to do any customization work.
I only ask if you have a hook for categories element I can use to add a custom class, that’s all.
It will save me a lot of time if a hook like this already exists.Thanks
September 30, 2025 at 8:39 am #688655
Hung PhamParticipantHi hofitd,
Thanks for your patience.
WooCommerce provides a hook for this. You can use the
product_cat_class filter
to add your own custom class to category elements. Here are some references that explain how to do it:https://wp-kama.com/plugin/woocommerce/hook/product_cat_class
https://stackoverflow.com/questions/55405633/add-a-class-to-the-category-list-items-on-woocommerce-shop-pageRegards,
Hung PD -
AuthorPosts
- You must be logged in to create new topics. Login / Register