Is there a way to display a menu using the ol tag instead of the default ul tag?
-
29-09-2020 - |
Question
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?
Solution
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
.
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange