Skip to content

Instantly share code, notes, and snippets.

@barbwiredmedia
Created September 24, 2013 21:48
Show Gist options
  • Save barbwiredmedia/6691774 to your computer and use it in GitHub Desktop.
Save barbwiredmedia/6691774 to your computer and use it in GitHub Desktop.
Wordpress - Templates: wp_get_nav_menu_object , wp_nav_menu To create a navigation menu with a header right above it. Calls the menu from WP and uses the title founded under Appearance > Menus and puts it in a header tag
<?php
$menu_location = 'Footer-Nav-Column-1';
$menu_locations = get_nav_menu_locations();
$menu_object = (isset($menu_locations[$menu_location]) ? wp_get_nav_menu_object($menu_locations[$menu_location]) : null);
$menu_name = (isset($menu_object->name) ? $menu_object->name : '');
echo ('<h4>');
echo esc_html($menu_name);
echo ('</h4>');
wp_nav_menu(array('theme_location' => $menu_location, 'menu_class' => 'nav'));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment