Hide categories from category loop
-
Hi
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 product
Thank you
Hofit
Hi 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 PD
Hello
there is no ID in the code.
see attached screenshot.
Attachments:
You must be
logged in to view attached files.
Hi 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 PD