From 8b6d718a942a3c81715b321d4e5c6752d14431a0 Mon Sep 17 00:00:00 2001 From: Michael Vieth Date: Fri, 8 Jul 2016 13:51:28 -0600 Subject: [PATCH 1/4] Added Bootstrap Nav Walker + Navigation Header to the default theme. --- functions.php | 13 +- lib/wp_bootstrap_nav_walker.php | 206 ++++++++++++++++++++++++++++++++ templates/header.php | 27 ++++- 3 files changed, 234 insertions(+), 12 deletions(-) create mode 100644 lib/wp_bootstrap_nav_walker.php diff --git a/functions.php b/functions.php index 35df8db212..1e71109b9c 100644 --- a/functions.php +++ b/functions.php @@ -10,12 +10,13 @@ * @link https://github.com/roots/sage/pull/1042 */ $sage_includes = [ - 'lib/assets.php', // Scripts and stylesheets - 'lib/extras.php', // Custom functions - 'lib/setup.php', // Theme setup - 'lib/titles.php', // Page titles - 'lib/wrapper.php', // Theme wrapper class - 'lib/customizer.php' // Theme customizer + 'lib/assets.php', // Scripts and stylesheets + 'lib/extras.php', // Custom functions + 'lib/setup.php', // Theme setup + 'lib/titles.php', // Page titles + 'lib/wrapper.php', // Theme wrapper class + 'lib/customizer.php', // Theme customizer + 'lib/wp_bootstrap_nav_walker.php', // Bootstrap Nav Walker ]; foreach ($sage_includes as $file) { diff --git a/lib/wp_bootstrap_nav_walker.php b/lib/wp_bootstrap_nav_walker.php new file mode 100644 index 0000000000..94d7f9b92f --- /dev/null +++ b/lib/wp_bootstrap_nav_walker.php @@ -0,0 +1,206 @@ +\n"; + } + + /** + * @see Walker::start_el() + * @since 3.0.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param object $item Menu item data object. + * @param int $depth Depth of menu item. Used for padding. + * @param int $current_page Menu item ID. + * @param object $args + */ + public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { + $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; + + /** + * Dividers, Headers or Disabled + * ============================= + * Determine whether the item is a Divider, Header, Disabled or regular + * menu item. To prevent errors we use the strcasecmp() function to so a + * comparison that is not case sensitive. The strcasecmp() function returns + * a 0 if the strings are equal. + */ + if ( strcasecmp( $item->attr_title, 'divider' ) == 0 && $depth === 1 ) { + $output .= $indent . ''; + $fb_output .= ''; + + if ( $container ) + $fb_output .= ''; + + echo $fb_output; + } + } +} \ No newline at end of file diff --git a/templates/header.php b/templates/header.php index a971013f96..9d760d80d3 100644 --- a/templates/header.php +++ b/templates/header.php @@ -1,12 +1,27 @@ From 1d8dc019f05e49e243286465a429e826f87fa36a Mon Sep 17 00:00:00 2001 From: Michael Vieth Date: Fri, 8 Jul 2016 14:02:54 -0600 Subject: [PATCH 2/4] Fixed header. --- templates/header.php | 47 ++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/templates/header.php b/templates/header.php index 9d760d80d3..3b1d028705 100644 --- a/templates/header.php +++ b/templates/header.php @@ -1,27 +1,22 @@ - + + \ No newline at end of file From d0bfa4c66a4c514f3f3ab538b99457c2a33ef7ac Mon Sep 17 00:00:00 2001 From: Michael Vieth Date: Fri, 8 Jul 2016 14:04:07 -0600 Subject: [PATCH 3/4] Full Width Page Template. --- template-full-width.php | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 template-full-width.php diff --git a/template-full-width.php b/template-full-width.php new file mode 100644 index 0000000000..16d5e95b01 --- /dev/null +++ b/template-full-width.php @@ -0,0 +1,10 @@ + + + + + + From d3122656d595c892420fed77bba7670c6707ddb9 Mon Sep 17 00:00:00 2001 From: Michael Vieth Date: Fri, 8 Jul 2016 14:04:21 -0600 Subject: [PATCH 4/4] Full Width Page Template. --- lib/setup.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/setup.php b/lib/setup.php index b9f962d18b..af57f67dd5 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -86,6 +86,7 @@ function display_sidebar() { is_404(), is_front_page(), is_page_template('template-custom.php'), + is_page_template('template-full-width.php'), ]); return apply_filters('sage/display_sidebar', $display);