I have a custom menu that I can call just fine using wp_nav_menu. Is there a way to have the menu name displayed inside an h3 tag before the menu?
Ex.
<h3>My Menu Name</h3>
<nav>
<ul>
<li>Menu Item 1</li>
<li>Menu Item 2</li>
</ul>
</nav>
I have a custom menu that I can call just fine using wp_nav_menu. Is there a way to have the menu name displayed inside an h3 tag before the menu?
Ex.
<h3>My Menu Name</h3>
<nav>
<ul>
<li>Menu Item 1</li>
<li>Menu Item 2</li>
</ul>
</nav>
You must be logged in to post a comment.
If you know the menu’s slug, then things are easier, otherwise you can use this function to get the menu at a specified location.
Then
Or, rather than echo the html, you could pass it as part of the the argument for the items attribute in
wp_nav_menu
.For example, to display the menu at location ‘primary’:
replace the id 4 below with the id of your menu. if you don’t know the id go into the menus page of the admin, right click on the tab of the menu you want to echo the title for, inspect elemenent and the id will be listed as menu=ID in the link.
stephen’s answer is good. but i put it one step further:
assuming you have a registered a theme location called “footer_navigation3” and assigned a wp menu to that.
now place this code where ever you want to display your menu.