/** * Nav menu attributes. * * @since 2.0.0 * @access public * @param array $attr * @param string $context * @return array */ function hybrid_attr_menu($attr, $context) { if (!empty($context)) { $attr['id'] = "menu-{$context}"; } $attr['class'] = 'menu'; $attr['role'] = 'navigation'; if (!empty($context)) { /* Translators: The %s is the menu name. This is used for the 'aria-label' attribute. */ $attr['aria-label'] = esc_attr(sprintf(_x('%s Menu', 'nav menu aria label', 'hybrid-core'), hybrid_get_menu_location_name($context))); } $attr['itemscope'] = 'itemscope'; $attr['itemtype'] = 'http://schema.org/SiteNavigationElement'; return $attr; }
<?php if (has_nav_menu('secondary')) { // Check if there's a menu assigned to the 'secondary' location. ?> <nav <?php hybrid_attr('menu', 'secondary'); ?> > <h3 id="menu-secondary-title" class="menu-toggle"> <button class="screen-reader-text"><?php /* Translators: %s is the nav menu name. This is the nav menu title shown to screen readers. */ printf(_x('%s Menu', 'nav menu title', 'stargazer'), hybrid_get_menu_location_name('secondary')); ?> </button> </h3><!-- .menu-toggle --> <?php wp_nav_menu(array('theme_location' => 'secondary', 'container' => '', 'menu_id' => 'menu-secondary-items', 'menu_class' => 'menu-items', 'fallback_cb' => '', 'items_wrap' => '<div class="wrap"><ul id="%s" class="%s">%s</ul></div>')); ?> </nav><!-- #menu-secondary --> <?php } // End check for menu.
* @link http://flagshipwp.com/ * @since 1.0.0 */ ?> <?php if (has_nav_menu('after-header')) { ?> <nav <?php hybrid_attr('menu', 'after-header'); ?> > <span id="menu-after-header-title" class="menu-toggle off-screen"> <button class="screen-reader-text"><?php // Translators: %s is the nav menu name. This is the nav menu title shown to screen readers. printf(_x('%s Menu', 'nav menu title', 'compass'), hybrid_get_menu_location_name('after-header')); ?> </button> </span><!-- .menu-toggle --> <?php wp_nav_menu(array('theme_location' => 'after-header', 'container' => '', 'menu_id' => 'after-header', 'menu_class' => 'nav-menu after-header', 'fallback_cb' => '', 'items_wrap' => '<div class="wrap"><ul id="%s" class="%s">%s</ul></div>')); ?> </nav><!-- #menu-after-header --> <?php } // End check for menu.
* The secondary nav menu template. * * @package Compass * @subpackage HybridCore * @copyright Copyright (c) 2015, Flagship Software, LLC * @license GPL-2.0+ * @since 1.0.0 */ if (has_nav_menu('secondary')) { ?> <nav <?php hybrid_attr('menu', 'secondary'); ?> > <span id="menu-secondary-title" class="screen-reader-text"> <?php // Translators: %s is the nav menu name. This is the nav menu title shown to screen readers. printf(_x('%s', 'nav menu title', 'compass'), hybrid_get_menu_location_name('secondary')); ?> </span> <?php wp_nav_menu(array('theme_location' => 'secondary', 'container' => '', 'menu_id' => 'secondary', 'menu_class' => 'nav-menu secondary', 'fallback_cb' => '', 'items_wrap' => '<div ' . hybrid_get_attr('wrap', 'secondary-menu') . '><ul id="%s" class="%s">%s</ul></div>')); ?> </nav><!-- #menu-secondary --> <?php }