From f46f2da58279028aa55d01ed4382fce2ce7e0fcb Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 27 Oct 2016 12:26:33 -0400 Subject: [PATCH] Update off canvas menu for main level to be turned off. Don't output href for main level off canvas nav items that have children. --- lib/menu-walker.php | 48 ++++----------------------------------------- style.css | 2 +- 2 files changed, 5 insertions(+), 45 deletions(-) diff --git a/lib/menu-walker.php b/lib/menu-walker.php index 09edb3e..d68cd8a 100644 --- a/lib/menu-walker.php +++ b/lib/menu-walker.php @@ -22,52 +22,9 @@ class Glm_Theme_Top_Bar_Walker extends Walker_Nav_Menu { // Insert style to display page's thumbnail $depth == 0 && has_post_thumbnail((int)$object->object_id $item_style = ''; -// echo "
", print_r($object), "
"; - /*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 .= ""; - - } else if( $depth !== 0 && $object->type == "taxonomy") { - - //$thumbnail = z_taxonomy_image_url( (int)$object->object_id ); - $item_style .= ""; - - } else if( $depth !== 0 && ! has_post_thumbnail( (int)$object->object_id ) ){ - - $thumbnail = get_template_directory_uri() . '/assets/header-images-2.jpg'; - $item_style .= ""; - } - */ - //$output .= ( 0 == $depth ) ? '
  • ' : ''; $classes = empty( $object->classes ) ? array() : (array) $object->classes; if ( in_array( 'label', $classes ) ) { - //$output .= '
  • '; $item_html = preg_replace( '/]*>(.*)<\/a>/iU', '', $item_html ); } if ( in_array( 'divider', $classes ) ) { @@ -104,6 +61,10 @@ class Glm_Theme_Off_Canvas_Walker extends Walker_Nav_Menu { $item_html = preg_replace( '/]*>(.*)<\/a>/iU', '', $item_html ); } + if ( $depth === 0 && $object->has_children ) { + $item_html = preg_replace( '/]*>(.*)<\/a>/iU', '$1', $item_html ); + } + $output .= $item_html; } @@ -116,4 +77,3 @@ class Glm_Theme_Off_Canvas_Walker extends Walker_Nav_Menu { } } endif; -?> diff --git a/style.css b/style.css index 47e7cc7..ed35ed6 100644 --- a/style.css +++ b/style.css @@ -3,5 +3,5 @@ Theme Name: MackinacBridgeAuthority Author: Gaslight Media Author URI: http://www.gaslightmedia.com Description: A theme for MackinacBridgeAuthority -Version: 1.0.0 +Version: 1.0.1 */ -- 2.17.1