added regex
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 23 Nov 2015 21:03:03 +0000 (16:03 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 23 Nov 2015 21:03:03 +0000 (16:03 -0500)
search.php

index 8aac996..f334542 100644 (file)
@@ -38,7 +38,7 @@
                                 // Load content as plain text
                                 global $wp_query, $post;
                                 $content = (!post_password_required($post) ? strip_tags(preg_replace(array("/\r?\n/", '@<\s*(p|br\s*/?)\s*>@'), array(' ', "\n"), apply_filters('the_content', $post->post_content))) : '');
-
+                                $content  = preg_replace('!\s+!', ' ', $content);
                                 // Search content for terms
                                 $terms = $wp_query->query_vars['search_terms'];
                                 if ( preg_match_all('/'.str_replace('/', '\/', join('|', $terms)).'/i', $content, $matches, PREG_OFFSET_CAPTURE) ) {