Last active
January 17, 2017 16:55
-
-
Save leanda/5072637 to your computer and use it in GitHub Desktop.
WordPress: Custom footer menus with titles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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