patric-boehner
9/25/2017 - 1:40 AM

Get the title of a menu based on theme location

Get the Title of a menu based on theme location

<?php

$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'	=> 'featured',
    'container'			=> 'div',
    'menu_class'		=> 'featured-client',
    'depth'				=> 1
  ) );
  
}