From 910064803c74848f5a98ea731e4041d2c54038e8 Mon Sep 17 00:00:00 2001 From: Laury GvR Date: Tue, 7 May 2019 16:25:31 -0400 Subject: [PATCH] Check for specific dropdown thumbs before iterating over all thumbs --- lib/menu-walker.php | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/lib/menu-walker.php b/lib/menu-walker.php index 4f13185..a675108 100644 --- a/lib/menu-walker.php +++ b/lib/menu-walker.php @@ -34,22 +34,20 @@ class Glm_Theme_Top_Bar_Walker extends Walker_Nav_Menu { // $item_html .= ""; // } ////// 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 ), 'dropdown-thumbnail' ); - + if( $depth !== 0 && 1464 == (int)$object->ID ){ + $thumbnail = get_template_directory_uri() . '/assets/run-mackinac.jpg'; $item_style .= ""; - } else if($object->classes[0] === 'family-specials' ){ - $thumbnail = get_template_directory_uri() . '/assets/family%20specials%20for%20nav.jpg'; + } else if( $depth !== 0 && 1465 == (int)$object->ID ){ + $thumbnail = get_template_directory_uri() . '/assets/chicago-yacht-race.jpg'; $item_style .= ""; - - } else if($object->classes[0] === 'multiple-trips' ){ - $thumbnail = get_template_directory_uri() . '/assets/Multiple%20trips.jpg'; + } else if ( $depth !== 0 && has_post_thumbnail( (int)$object->object_id ) ) { + $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( (int)$object->object_id ), 'dropdown-thumbnail' ); $item_style .= ""; - } else if($object->classes[0] === 'classic-ferry' ){ - $thumbnail = get_template_directory_uri() . '/assets/classic-ferry.jpg'; + } else if($object->classes[0] === 'family-specials' ){ + $thumbnail = get_template_directory_uri() . '/assets/family%20specials%20for%20nav.jpg'; $item_style .= ""; - } else if($object->classes[0] === 'all-ticket-options' ){ - $thumbnail = get_template_directory_uri() . '/assets/All-Tickets-to-Mackinac-Island-Option-Featured-Image-400x200.png'; + } else if($object->classes[0] === 'multiple-trips' ){ + $thumbnail = get_template_directory_uri() . '/assets/Multiple%20trips.jpg'; $item_style .= ""; - } else if( $depth !== 0 && ! has_post_thumbnail( (int)$object->object_id ) ){ - $thumbnail = get_template_directory_uri() . '/assets/is43-1401554613-28521.jpg'; + } else if($object->classes[0] === 'classic-ferry' ){ + $thumbnail = get_template_directory_uri() . '/assets/classic-ferry.jpg'; $item_style .= ""; - } else if( $depth !== 0 && 1464 == (int)$object->ID ){ - $thumbnail = get_template_directory_uri() . '/assets/run-mackinac.jpg'; + } else if($object->classes[0] === 'all-ticket-options' ){ + $thumbnail = get_template_directory_uri() . '/assets/All-Tickets-to-Mackinac-Island-Option-Featured-Image-400x200.png'; $item_style .= ""; - } else if( $depth !== 0 && 1465 == (int)$object->ID ){ - $thumbnail = get_template_directory_uri() . '/assets/chicago-yacht-race.jpg'; + } else if( $depth !== 0 && ! has_post_thumbnail( (int)$object->object_id ) ){ + $thumbnail = get_template_directory_uri() . '/assets/is43-1401554613-28521.jpg'; $item_style .= ""; + } //$output .= ( 0 == $depth ) ? '
  • ' : ''; $classes = empty( $object->classes ) ? array() : (array) $object->classes; -- 2.17.1