Hi 🙂
I am working on a Woocommerce Categorie submenu.
It goes 3 levels deep, for example:
- Toys
- Wooden toys
- wooden cars
- wooden horse
- Race cars
- blue race cars
- red race cars
- Lego
- Lego city
- Lego friends
- Wooden toys
Two thing I am trying to fix:
- When a visitor is on a level 2 page (for example “Lego”), I only want it to display its children (“Lego City”, “Lego Friends”), and the other parents (“Wooden Toys”, “Race cars”, “Lego”). Now it is showing also the children of the other parents (“Wooden cars”, etc).
- When a visitor is on a level 3 page (for example “Lego city”), I want it to display its sisters and itself (“Lego city”, “Lego Friends”) and also the the level 2 categories above (“Lego”, “Race cars”, “Wooden toys”)
I am a close, but not there yet. Can you help me out :)?
Many thanks in advance!
Kind regards,
Remco
OnPoint Plugins
Hi Remco,
This may be accomplished by adding the following filter to your active theme’s functions.php file.
The filter makes these changes:
Have a great day!
Remco Harmsen
You, dear sir or madam, are amazing.
This code does exactly what I wanted.
Many thanks 🙂
Remco Harmsen
I am sorry, but when exanding the menu it seems I still have a request left.
Hope you can also make this happen 🙂
I added another top level category (we already had “Toys”, now I added “Baby”), and I found a problem.
When a visitor is browsing sub categories of “Toys”, I need to keep those from another grandparents invisible.
On this example https://www.aanbiedingenbaas.nl/toys/lego/ “Romper” can not show since it is a child of another top category.
The other way around, when on https://www.aanbiedingenbaas.nl/baby/romper/, I want to hide every other categorie that is not in “Baby”: “Lego”, “Race cars” and “Wooden toys”.
Would love to hear from you!
OnPoint Plugins
Hi Remco,
If I’m understanding correctly, I think you just need to uncheck the “Display widget on every page” option and menu may display how you like.
Let me know if that doesn’t do it and I’ll help you customize further.
Have a great day!
Remco Harmsen
Yes, that did the trick.
Many thanks again 🙂
Remco Harmsen
Hello again,
Still loving the plugin, but when expanding my website I encountered an issue I’d like your help with.
The custom code your wrote for me in this topic needs a little change.
It worked perfectly for a product category with a sub and a sub-sub category.
Right now, I am adding sub-sub-sub categories.
The change I need:
When on a subcategorie, it is showing sub and sub-sub, I need it to hide the sub-sub-sub.
I only want these sub-sub-sub to show when a user is on the related sub-sub category.
For example on: https://www.aanbiedingenbaas.nl/kat/kattenvoer/
The sub-sub-sub categories “Royal Canin Kitten aanbieding” and “Royal Canin Maine Coon aanbieding” can only show up when a user clicks on their parent “Royal Canin kattenvoer aanbieding”.
Also, other siblings like “Krabpaal aanbieding” need to hide.
Can you make this happen 🙂 ?
OnPoint Plugins
Hi Remco,
This may be accomplished by adding the following custom CSS to your site.
Have a great day!