Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Wrap wp_nav_menu output around option tags for select menu

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #44908
    croydon86
    Participant

    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.

    #135767
    Alen
    Participant
    #135774
    croydon86
    Participant

    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.

    #135901
    croydon86
    Participant

    Sorry I was using the wrong function.

    wp_dropdown_categories was the function I was looking for which does this by default.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.