From 91648d6bd397cc5103a1106b48443a5a6228ab0f Mon Sep 17 00:00:00 2001 From: Ian Weller Date: Mon, 23 Nov 2015 16:56:09 -0500 Subject: [PATCH] added missing part of walker --- lib/menu-walker.php | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/lib/menu-walker.php b/lib/menu-walker.php index 611e3f3..95ae1f8 100644 --- a/lib/menu-walker.php +++ b/lib/menu-walker.php @@ -10,16 +10,36 @@ class Feature_Top_Bar_Walker extends Walker_Nav_Menu { $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 ) ? 'has-dropdown' : ''; - $element->classes[] = ( $element->post_parent == 0 && $mainLevelCounter > 3 ) ? 'drop-left' : ''; + $element->classes[] = ( $element->post_parent == 0 && $mainLevelCounter < 3 ) ? '' : 'drop-left'; 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 ); + +// // 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 .= ""; +// } +// //$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 ) ) { +// $item_html = preg_replace( '/]*>( .* )<\/a>/iU', '', $item_html ); +// } + if ($item_style) + $output .= $item_style; + $output .= $item_html; + } function start_lvl( &$output, $depth = 0, $args = array() ) { - if ($depth == 0) { - $output .= "\n
      \n"; - } + $output .= "\n
        \n"; } } -- 2.17.1