From: Steve Sutton Date: Tue, 29 Dec 2015 16:15:34 +0000 (-0500) Subject: Updating the menus X-Git-Tag: v1.0.0^2~188 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=05a37196a6be7d147b8fb286c3cbaacd2c4773b2;p=WP-Themes%2Fotsego.git Updating the menus Use separate menu for each main level menu item. --- diff --git a/lib/menu-walker.php b/lib/menu-walker.php index 64b5a96..a4035f0 100644 --- a/lib/menu-walker.php +++ b/lib/menu-walker.php @@ -22,10 +22,10 @@ class Glm_Theme_Top_Bar_Walker extends Walker_Nav_Menu { // Insert style to display page's thumbnail $item_style = ''; - if ($depth == 0 && has_post_thumbnail((int)$object->object_id)) { - $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id((int)$object->object_id), 'large'); - $item_style .= ""; - } + //if ($depth == 0 && has_post_thumbnail((int)$object->object_id)) { + //$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id((int)$object->object_id), 'large'); + //$item_style .= ""; + //} //$output .= ( 0 == $depth ) ? '
  • ' : ''; $classes = empty( $object->classes ) ? array() : (array) $object->classes; if ( in_array( 'label', $classes ) ) { diff --git a/lib/navigation.php b/lib/navigation.php index 1380c34..6ae7e92 100644 --- a/lib/navigation.php +++ b/lib/navigation.php @@ -1,29 +1,48 @@ 'Site Navigation' + 'top-bar-1' => 'Top Nav One', + 'top-bar-2' => 'Top Nav Two', + 'top-bar-3' => 'Top Nav Three', + 'top-bar-4' => 'Top Nav Four', + 'top-bar-5' => 'Top Nav Five', + 'top-bar-6' => 'Top Nav Six' )); /** * Top Bar */ if ( ! function_exists( 'glm_theme_top_bar' ) ) { - function glm_theme_top_bar() { - wp_nav_menu(array( - 'container' => false, // remove nav container - 'container_class' => '', // class of container - 'menu' => '', // menu name - 'menu_class' => '', // adding custom nav class - 'theme_location' => 'top-bar', // where it's located in the theme - 'before' => '', // before each link - 'after' => '', // after each link - 'link_before' => '', // before each link text - 'link_after' => '', // after each link text - 'depth' => 3, // limit the depth of the nav - 'fallback_cb' => false, // fallback function (see below) - 'walker' => new Glm_Theme_Top_Bar_Walker() - )); - } + function glm_theme_top_bar() { + echo ''; + } +} + +function glm_get_top_bar_nav_menu( $theme_location ) +{ + $menu = wp_nav_menu(array( + 'echo' => false, // don't echo + 'container' => false, // remove nav container + 'container_class' => '', // class of container + 'menu' => '', // menu name + 'menu_class' => '', // adding custom nav class + 'theme_location' => $theme_location, // where it's located in the theme + 'before' => '', // before each link + 'after' => '', // after each link + 'link_before' => '', // before each link text + 'link_after' => '', // after each link text + 'depth' => 3, // limit the depth of the nav + 'fallback_cb' => false, // fallback function (see below) + 'walker' => new Glm_Theme_Top_Bar_Walker() + )); + return preg_replace( array( '%^]*>%', '%$%' ), '', $menu ); } /** @@ -33,24 +52,36 @@ if ( ! function_exists( 'glm_theme_mobile_off_canvas' ) ) { function glm_theme_mobile_off_canvas() { echo '
    '; echo '
    • Home
    • '; - wp_nav_menu(array( - 'container' => false, // remove nav container - 'container_class' => '', // class of container - 'menu' => '', // menu name - 'menu_class' => 'off-canvas-list', // adding custom nav class - 'theme_location' => 'top-bar', // where it's located in the theme - 'before' => '', // before each link - 'after' => '', // after each link - 'link_before' => '', // before each link text - 'link_after' => '', // after each link text - 'depth' => 5, // limit the depth of the nav - 'fallback_cb' => false, // fallback function (see below) - 'walker' => new Glm_Theme_Off_Canvas_Walker() - )); + echo glm_get_mobile_nav_menu( 'top-bar-1' ); + echo glm_get_mobile_nav_menu( 'top-bar-2' ); + echo glm_get_mobile_nav_menu( 'top-bar-3' ); + echo glm_get_mobile_nav_menu( 'top-bar-4' ); + echo glm_get_mobile_nav_menu( 'top-bar-5' ); + echo glm_get_mobile_nav_menu( 'top-bar-6' ); echo '
    '; } } +function glm_get_mobile_nav_menu( $theme_location ) +{ + $menu = wp_nav_menu(array( + 'echo' => false, // don't echo + 'container' => false, // remove nav container + 'container_class' => '', // class of container + 'menu' => '', // menu name + 'menu_class' => 'off-canvas-list', // adding custom nav class + 'theme_location' => $theme_location, // where it's located in the theme + 'before' => '', // before each link + 'after' => '', // after each link + 'link_before' => '', // before each link text + 'link_after' => '', // after each link text + 'depth' => 5, // limit the depth of the nav + 'fallback_cb' => false, // fallback function (see below) + 'walker' => new Glm_Theme_Off_Canvas_Walker() + )); + return preg_replace( array( '%^]*>%', '%$%' ), '', $menu ); +} + /** * Footer */