Skip to content

Instantly share code, notes, and snippets.

@patric-boehner
Last active September 26, 2017 06:19
Show Gist options
  • Save patric-boehner/51ab78cd5cd6c792a0a4603bebcb10fa to your computer and use it in GitHub Desktop.
Save patric-boehner/51ab78cd5cd6c792a0a4603bebcb10fa to your computer and use it in GitHub Desktop.
Get the Title of a menu based on theme location
<?php
//* Don't include the opening tag
$theme_location = 'featured';
$theme_locations = get_nav_menu_locations();
$nav_menu_ID = $theme_locations[$theme_location];
$nav_menu_title = wp_get_nav_menu_object( $nav_menu_ID );
if ( has_nav_menu( 'featured' ) ) {
// Echo out the title, should probably escape the output
echo '<h3 class="widget-title">' .$nav_menu_title->name. '</h3>';
genesis_nav_menu( array(
'theme_location' => 'secondary',
'container' => 'div',
'menu_class' => 'class-name',
'depth' => 1
) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment