0

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!

2
  • 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. Jul 5, 2011 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, 2011 at 21:37

1 Answer 1

1

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;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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