From e623ac15d29f77d2f27deea9edcf67dec99cdbbb Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Wed, 14 Oct 2015 11:16:38 -0400 Subject: [PATCH] Update drop down menu Worked out a way to add the featured images into the drop down nav using jquery to add an image tag. --- functions.php | 23 +++++++++++++++++++---- js/app.js | 8 ++++++++ js/custom/pageSetup.js | 8 ++++++++ 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/functions.php b/functions.php index da4f409..6718484 100644 --- a/functions.php +++ b/functions.php @@ -123,8 +123,8 @@ class Feature_Top_Bar_Walker extends Walker_Nav_Menu { // 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), 'medium'); - $item_style .= ""; + $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id((int)$object->object_id), 'bpla-drop-down'); + //$item_style .= ""; } //$output .= ( 0 == $depth ) ? '
  • ' : ''; $classes = empty( $object->classes ) ? array() : (array) $object->classes; @@ -135,13 +135,23 @@ class Feature_Top_Bar_Walker extends Walker_Nav_Menu { if ( in_array( 'divider', $classes ) ) { $item_html = preg_replace( '/]*>( .* )<\/a>/iU', '', $item_html ); } - if ($item_style) + if ($item_style) { $output .= $item_style; + } + if ($depth == 0 && has_post_thumbnail((int)$object->object_id) && $object->has_children) { + $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id((int)$object->object_id), 'bpla-drop-down'); + $item_html .= ''; + //$item_html .= '
    ' . print_r($object, true) . '
    '; + } $output .= $item_html; } function start_lvl( &$output, $depth = 0, $args = array() ) { - $output .= "\n