I have created a number of custom menu slots in my WordPress theme, and the output of the links into them has been very easy. Unfortunately I cannot find a way to output the user entered title for the menu above the list in each menu slot. This doesn't seem to come with the default WordPress function.

I am wondering if there is a simple and efficient way to grab the user entered name of the menu that is currently in a slot in my theme. [Somewhat like the way the widgets function allows you to chose whether you want to show the title of the specific widget.]

Thanks in advance.

EDIT: Still looking for help!

link|improve this question
Read the source code to see how that text is being stored and if there's a getter for it. If not, read it from the database yourself. – Dan Grossman Jul 5 '11 at 3:10
The issue with that is that I don't know of a way to get the ID of the current custom menu in a specific menu slot. Since they have the ability to add the menu's in any order they desire. – BorisKourt Jul 16 '11 at 21:37
feedback

migrated from stackoverflow.com Jul 5 '11 at 11:28

This question came from our site for professional and enthusiast programmers.

1 Answer

From quick look at wp_nav_menu() code:

function get_menu_name($location) {

    $locations = get_nav_menu_locations();
    $id = $locations[$location];
    $menu = wp_get_nav_menu_object($id);

    return $menu->name;
}
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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