- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hi all
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…
array(
‘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.
Sorry I was using the wrong function.
wp_dropdown_categories was the function I was looking for which does this by default.