diff --git a/kit/functions.php b/kit/functions.php index 259cfaa..7000ac5 100644 --- a/kit/functions.php +++ b/kit/functions.php @@ -476,15 +476,25 @@ function generate_excerpt($text, $query, $length) { $excerptRet .= $excerpt . ' ...

'; return $excerptRet; + } function search_excerpt_highlight() { - $length = 32; - $text = wp_strip_all_tags( get_the_content() ); - $query = explode(' ', get_search_query()); + # Length in word count + $excerptLength = 32; + + $text = wp_strip_all_tags( get_the_content() ); + + # Filter double quotes from query. They will + # work on the results side but won't help with + # text highlighting and displaying. + $query=get_search_query(false); + $query=str_replace('"','',$query); + $query=esc_html($query); + + $query = explode(' ', $query); + + echo generate_excerpt($text, $query, $excerptLength); - print_r($query); - - echo generate_excerpt($text, $query, $length); }