I have set up a wp_nav_menu in WordPress. I have 2 parent categories, with 2 sub-categories each, so this produces a nested list.
My current code to call this menu is…
< ?php wp_nav_menu(
‘theme_location’ => ‘shop-categories’,
‘container’ => ‘nav’,
‘container_class’ => ‘shop-cat’
… which outputs this…
(I have simplified the code so you just get an idea of the markup)
Now I would like to output this…
…is this possible to do dynamically? Or will it be better to do this manually? I have had a look around but couldn’t find any help on this.
Any help appreciated.
You will need to extend Walker Class for wp_nav_menu(): http://wordpress.stackexchange.com/questions/14037/menu-items-description-custom-walker-for-wp-nav-menu
Thanks for pointing me in the right direction.
Looking at that code…pretty complex for a PHP novice!
I may consider a manual solution as I can see the optgroup labels being a problem.
This reply has been reported for inappropriate content.
Is there a particular reason you’re wanting to spit out a form using the custom menu system?
What’s the functionality you’re looking for here ?
Sorry I was using the wrong function.
wp_dropdown_categories was the function I was looking for which does this by default.
You must be logged in to reply to this topic.