/ Published in: PHP
Example call: $menuName = sleek_get_theme_menu_name('footer-menu')
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/*----------------------------------------------------------- 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(); $menu_obj = get_term($theme_locations[$theme_location],'nav_menu'); if(!$menu_obj) $menu_obj = false; // Make a slug out of the menu name now we know it exists return $menu_name; }