Archived topic
woo-cat-nav Niche theme - how sub-categories appear in the menu
5 replies · Started by David Bennett on January 30, 2022
I created a WooCommerce test site and imported the Niche theme and content from the site library. So far so good.
Then I took one of the product categories (hoodies), and made it a sub-category of clothing.
I thought that would take hoodies out of the top line of the product category menu and make it appear as a drop-down under clothing. But that is not what happened. Instead, hoodies remains on the top (the only) line.
Is that expected behaviour or am I missing something? Perhaps I would need a mega-menu to show sub-categories?
Thanks
Hi David,
The categories aren't made from menus so the script that makes the dropdown doesn't apply to it. :)
It's a list made from the script added through the pre-built site template's Appearance > Elements. It's on the Hook element named "Woocommerce Shop Category Menu".
If you're using a WP 5.9. You may want to consider replacing it w/ a Block Element containing a Navigation block.
Consider creating a WooCommerce category menu as well to be placed in this Navigation block. :D
Thanks Elvin,
I saw the element before I asked, and I saw David's reply to Lee (#1345768) when Lee asked if the 'menu' could show only the top line categories and David suggested to include include 'parent' => 0 in $cat_args - which is what {wrongly) made me think that it would include a drop-down.
In principle, even if would be custom work, would it be possible to add a script that would make a drop-down using that element?
In principle, even if would be custom work, would it be possible to add a script that would make a drop-down using that element?
That's true. And it may be best to actually just do that if you're familiar with JS.
Dropdowns, to put simply, is basically toggling a class attribute through a script. Where the class has styles to show/hide an element. (display:none; / display:block;)
And the HTML structure is usually something like this.
[menu-item #1]
> [menu-item / sub-menu trigger]
> [sub menu-item container]
> > [sub menu-items]
> > [sub menu-items]
> > [sub menu-items]
[menu-item #2]
> [menu-item / sub-menu trigger]
> [sub menu-item container]
> > [sub menu-items]
> > [sub menu-items]
> > [sub menu-items]
[menu-item #3]
> [menu-item / sub-menu trigger]
> [sub menu-item container]
> > [sub menu-items]
> > [sub menu-items]
> > [sub menu-items]
Thank you. I will mark this 'resolved'
No problem. Let us know if you have further questions. :D