wp-bootstrap-navwalker icon indicating copy to clipboard operation
wp-bootstrap-navwalker copied to clipboard

Top-level menu item with subitems is wrong when depth=1

Open russellbrown opened this issue 12 years ago • 3 comments

Suppose my menu structure looks like this:

/home
/products
    /products/books
    /products/dvds
/contact

With the default wp_nav_menu settings (depth=0) the walker correctly outputs the full nested menu including the books and dvds subitems.

With depth=1 the walker correctly outputs only home, products and contact without any subitems, however the 'products' item links to '#' instead of '/products' and it includes the caret icon as if there are subitems nested under it. Is this a bug?

russellbrown avatar May 12 '14 10:05 russellbrown

The walker is purposely limited to only one level of drop down as the CCS & JS with Bootstrap 3+ is built for only one level as it is well supported on mobile devices. On May 12, 2014 6:24 AM, "russellbrown" [email protected] wrote:

Suppose my menu structure looks like this:

/home /products /products/books /products/dvds /contact

With the default wp_nav_menu settings (depth=0) the walker correctly outputs the full nested menu including the books and dvds subitems.

With depth=1 the walker correctly outputs only home, products and contact without any subitems, however the 'products' item links to '#' instead of '/products' and it includes the caret icon as if there are subitems nested under it. Is this a bug?

— Reply to this email directly or view it on GitHubhttps://github.com/twittem/wp-bootstrap-navwalker/issues/109 .

SideQuestDIY avatar May 12 '14 10:05 SideQuestDIY

Thanks v much for the quick reply. The problem isn't that it's limited to one level of dropdown, that's fine. The problem is that when you configure wp_nav_menu to use depth=1, i.e. only display the top-level items in the menu, if any of those top-level items have child items (which are correctly omitted from the output due to depth=1), then the top-level item still gets href="#" and displays a caret. This doesn't make sense because there are no child items being output. Instead the href should be to the appropriate url and there shouldn't be a caret. Hope I've explained that properly!

russellbrown avatar May 12 '14 10:05 russellbrown

Sorry, I didn't get that from your post. Yes, this is true and something we are aware of. It's on the list of changes for the next version. On May 12, 2014 6:50 AM, "russellbrown" [email protected] wrote:

Thanks v much for the quick reply. The problem isn't that it's limited to one level of dropdown, that's fine. The problem is that when you configure wp_nav_menu to use depth=1, i.e. only display the top-level items in the menu, if any of those top-level items have child items (which are correctly omitted from the output due to depth=1), then the top-level item still gets href="#" and displays a caret. This doesn't make sense because there are no child items being output. Instead the href should be to the appropriate url and there shouldn't be a caret. Hope I've explained that properly!

— Reply to this email directly or view it on GitHubhttps://github.com/twittem/wp-bootstrap-navwalker/issues/109#issuecomment-42818454 .

SideQuestDIY avatar May 12 '14 12:05 SideQuestDIY