edit extra walker elements
authorIan Weller <ian@gaslightmedia.com>
Mon, 23 Nov 2015 22:01:07 +0000 (17:01 -0500)
committerIan Weller <ian@gaslightmedia.com>
Mon, 23 Nov 2015 22:01:07 +0000 (17:01 -0500)
lib/menu-walker.php

index 95ae1f8..12531af 100644 (file)
@@ -18,21 +18,21 @@ class Feature_Top_Bar_Walker extends Walker_Nav_Menu {
         $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 .= "<style>#menu-item-".$object->ID." > .dropdown:before { background-image: url('".$thumbnail[0]."');</style>";
-//        }
-//        //$output .= ( 0 == $depth ) ? '<li class="divider"></li>' : '';
-//        $classes = empty( $object->classes ) ? array() : (array) $object->classes;
-//        if ( in_array( 'label', $classes ) ) {
-//            //$output .= '<li class="divider"></li>';
-//            $item_html = preg_replace( '/<a[^>]*>(.*)<\/a>/iU', '<label>$1</label>', $item_html );
-//        }
-//        if ( in_array( 'divider', $classes ) ) {
-//            $item_html = preg_replace( '/<a[^>]*>( .* )<\/a>/iU', '', $item_html );
-//        }
+        // 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 .= "<style>#menu-item-".$object->ID." > .dropdown:before { background-image: url('".$thumbnail[0]."');</style>";
+        }
+        //$output .= ( 0 == $depth ) ? '<li class="divider"></li>' : '';
+        $classes = empty( $object->classes ) ? array() : (array) $object->classes;
+        if ( in_array( 'label', $classes ) ) {
+            //$output .= '<li class="divider"></li>';
+            $item_html = preg_replace( '/<a[^>]*>(.*)<\/a>/iU', '<label>$1</label>', $item_html );
+        }
+        if ( in_array( 'divider', $classes ) ) {
+            $item_html = preg_replace( '/<a[^>]*>( .* )<\/a>/iU', '', $item_html );
+        }
         if ($item_style)
             $output .= $item_style;
         $output .= $item_html;