1

I'm trying to display a menu using wp_nav_menu(). The default markup that the function generates is a menu parented by a <ul> tag like so:

<ul>
    <li><a>Menu 1</a></li>
    <li><a>Menu 2</a></li>
    <li><a>Menu 3</a></li>
</ul>

My question is, is there a way to display a menu using the <ol> tag instead of the default <ul> tag?

2

You can make use of the items_wrap parameter to achieve this. For example like this:

'items_wrap' => '<ol id="%1$s" class="%2$s">%3$s</ol>'

More information at codex: wp_nav_menu.

  • 1
    This answer makes the top-most level <ul> into <ol>. However, submenus will still be rendered using <ul> – Abel Melquiades Callejo Dec 1 '14 at 14:08
  • 1
    Then you have to extend and customize the Walker_Nav_Menu class. Take a look around there are plenty of answers concerning this around. @AbelMelquiadesCallejo – Nicolai Dec 1 '14 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.