From 6ff75317776049631e562c5fc8e79153c5d123a1 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 28 Sep 2015 12:56:07 -0400 Subject: [PATCH] Update the off canvas menu Using the Appearance menu now and not pages --- functions.php | 59 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/functions.php b/functions.php index 7d0b572..d4708ad 100644 --- a/functions.php +++ b/functions.php @@ -167,13 +167,62 @@ if (!function_exists('glm_get_clientinfo_option')) { */ function glm_offcanvas_menu() { - wp_page_menu(array( - 'depth' => 0, - 'sort_column' => 'menu_order', - 'menu_class' => 'left-off-canvas-list' - )); + echo ''; } +if ( ! class_exists( 'ExploreWesternUP_Offcanvas_Walker' ) ) : +class ExploreWesternUP_Offcanvas_Walker extends Walker_Nav_Menu { + + function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) { + $element->has_children = ! empty( $children_elements[ $element->ID ] ); + $element->classes[] = ( $element->current || $element->current_item_ancestor ) ? 'active' : ''; + $element->classes[] = ( $element->has_children && 1 !== $max_depth ) ? 'page_item_has_children' : ''; + $element->classes[] = 'page_item'; + + parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); + } + + function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) { + $item_html = ''; + parent::start_el( $item_html, $object, $depth, $args ); + + $classes = empty( $object->classes ) ? array() : (array) $object->classes; + + if ( in_array( 'label', $classes ) ) { + $item_html = preg_replace( '/]*>(.*)<\/a>/iU', '', $item_html ); + } + + $output .= $item_html; + } + + function start_lvl( &$output, $depth = 0, $args = array() ) { + $output .= "\n'; + } + +} +endif; + add_theme_support('post-thumbnails'); set_post_thumbnail_size(120, 100, true); /** -- 2.17.1