From: Anthony Talarico Date: Tue, 15 Mar 2016 12:40:49 +0000 (-0400) Subject: adding un-nested off canvas 'home' link back to menu, using separate functions and... X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=341ef3265bc13241e524391e0aa04f2988b35128;p=web%2FGruntInit%2FglmTheme.git adding un-nested off canvas 'home' link back to menu, using separate functions and regex to remove nested ul --- diff --git a/root/lib/navigation.php b/root/lib/navigation.php index f22a410..f5b5d91 100644 --- a/root/lib/navigation.php +++ b/root/lib/navigation.php @@ -32,25 +32,32 @@ if ( ! function_exists( 'glm_theme_top_bar' ) ) { if ( ! function_exists( 'glm_theme_mobile_off_canvas' ) ) { function glm_theme_mobile_off_canvas() { echo '
'; - - 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 '
'; + 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 */