Revision: 50949
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 9, 2011 20:03 by Huskie
Initial Code
/*-----------------------------------------------------------
Get a theme menu name in slug format based on a
location parameter.
-----------------------------------------------------------*/
function sleek_get_theme_menu_name($theme_location)
{
if(!$theme_location) return false;
$theme_locations = get_nav_menu_locations();
if(!isset($theme_locations[$theme_location])) return false;
$menu_obj = get_term($theme_locations[$theme_location],'nav_menu');
if(!$menu_obj) $menu_obj = false;
if(!isset($menu_obj->name)) return false;
// Make a slug out of the menu name now we know it exists
$menu_name = strtolower($menu_obj->name);
$menu_name = str_replace(" ","-", $menu_name);
return $menu_name;
}
Initial URL
http://darrenhuskie.com/
Initial Description
Example call: $menuName = sleek_get_theme_menu_name('footer-menu')
Initial Title
Get WordPress theme menu name in slug format from location parameter
Initial Tags
format, wordpress, theme
Initial Language
PHP