From 89324b00a7b8f99d4bbbb34a8d522c74488da38a Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Wed, 13 Jan 2016 08:07:17 -0500 Subject: [PATCH] Fix morkup issue with empty searches --- parts/search.php | 10 ++++------ search.php | 39 ++++++++++++++++++++++++--------------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/parts/search.php b/parts/search.php index 3b12364..3822165 100644 --- a/parts/search.php +++ b/parts/search.php @@ -1,7 +1,5 @@ \ No newline at end of file + + + + diff --git a/search.php b/search.php index c90a853..0b6c729 100644 --- a/search.php +++ b/search.php @@ -7,10 +7,20 @@
- -
+ +

Please enter a query in the search box.

+
+
+
+
+
+
+
+
+
+

Search Results for ""

@@ -32,9 +42,9 @@ // 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))) : ''); - + // 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) ) { @@ -69,19 +79,19 @@ } // Highlight matches - $context = nl2br(preg_replace('/'.str_replace('/', '\/', join('|', $terms)).'/i', '$0', $output)); - + $context = nl2br(preg_replace('/'.str_replace('/', '\/', join('|', $terms)).'/i', '$0', $output)); + ?>

- + - + ?>
@@ -108,11 +118,10 @@

-
- - + +
- - - + + + -- 2.17.1