Skip to content

Instantly share code, notes, and snippets.

@leanda
Last active January 17, 2017 16:55
Show Gist options
  • Save leanda/5072637 to your computer and use it in GitHub Desktop.
Save leanda/5072637 to your computer and use it in GitHub Desktop.
WordPress: Custom footer menus with titles
if ( function_exists( 'register_nav_menus' ) ) {
// This theme uses wp_nav_menu() in three locations.
register_nav_menus( array(
'footleft' => __( 'Footer Left Column'),
'footmiddle' => __('Footer Middle Column'),
'footright' => __('Footer Right Column')
) );
}
// This function gets the menu title
function wpse45700_get_menu_by_location( $location ) {
if( empty($location) ) return false;
$locations = get_nav_menu_locations();
if( ! isset( $locations[$location] ) ) return false;
$menu_obj = get_term( $locations[$location], 'nav_menu' );
return $menu_obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment