From: Anthony Talarico Date: Fri, 16 Dec 2016 14:00:15 +0000 (-0500) Subject: checking to see if the page has an excerpt before trying to access it X-Git-Tag: v1.0.0^2~49 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=d26b63671a0284facec09485bf9bab5aae3e9faa;p=WP-Themes%2Fmackinawareavb.git checking to see if the page has an excerpt before trying to access it to prevent getting the page content instead --- diff --git a/sections/top-bar.php b/sections/top-bar.php index a929638..4ca2206 100644 --- a/sections/top-bar.php +++ b/sections/top-bar.php @@ -34,7 +34,12 @@ foreach($post_data as $pd=>$value){ $image = false; } $image = wp_get_attachment_image_src( get_post_thumbnail_id( $value->ID ), array(300,250) ); - $dropdown[$value->ID]['excerpt'] = get_the_excerpt($value->ID); + if (has_excerpt($value->ID) ){ + $dropdown[$value->ID]['excerpt'] = get_the_excerpt($value->ID); + } else { + $dropdown[$value->ID]['excerpt'] = " "; + } + $dropdown[$value->ID]['menu'] = $pd; }