Fix morkup issue with empty searches
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 13 Jan 2016 13:07:17 +0000 (08:07 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 13 Jan 2016 13:07:17 +0000 (08:07 -0500)
parts/search.php
search.php

index 3b12364..3822165 100644 (file)
@@ -1,7 +1,5 @@
 <form role="search" method="get" class="searchform" action="<?php echo home_url('/'); ?>">
-     <input class="search-input" type="text" placeholder="Search" value="" name="s" class="lar-search">
-<!--     <input class="search-button" value="Search" name="searchButton">-->
-    <input id="input" class="search-button" type="submit" name="searchButton" value="Search">
-    <a id="magnifying-glass" class="show-for-large-up" href="#">
-    </a>
-</form>
\ No newline at end of file
+    <input class="search-input lar-search" type="text" placeholder="Search" value="" name="s" />
+    <input id="input" class="search-button" type="submit" name="searchButton" value="Search" />
+    <a id="magnifying-glass" class="show-for-large-up" href="#"></a>
+</form>
index c90a853..0b6c729 100644 (file)
@@ -7,10 +7,20 @@
 <main class="search-results">
     <div id="content-wrapper">
       <div class="row">
-       
-       <div id="blog-posts-over" class="small-12 medium-9 columns"> 
+
+       <div id="blog-posts-over" class="small-12 medium-9 columns">
            <?php if (get_search_query() == "") { ?>
            <h2 class="search-result-header small-12 columns">Please enter a query in the search box. </h2>
+            <div class="row content search-result-container">
+                <div class="small-11 small-centered columns">
+                    <br>
+                    <br>
+                    <br>
+                    <br>
+                    <br>
+                    <br>
+                </div>
+            </div>
            <?php } else { ?>
            <h2 class="search-result-header small-12 columns">Search Results for "<?php echo get_search_query(); ?>"</h2>
             <?php if(have_posts()) : while(have_posts()): the_post();?>
@@ -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) ) {
                                 }
 
                                 // Highlight matches
-                                $context = nl2br(preg_replace('/'.str_replace('/', '\/', join('|', $terms)).'/i', '<strong>$0</strong>', $output));                         
-                               
+                                $context = nl2br(preg_replace('/'.str_replace('/', '\/', join('|', $terms)).'/i', '<strong>$0</strong>', $output));
+
                                 ?>
 
                                 <p class="search_result_context">
                                   <?php echo $context ?>
                                 </p>
-                              
+
                 <!-- End of the Contextual/Highlight Search -->
 
                         <?php //echo (function_exists('the_advanced_excerpt')) ? the_advanced_excerpt(): the_excerpt(); ?>
                        <!-- <footer class="entry-meta small-12 medium-6 medium-push-3 center"> -->
-                          <?php 
+                          <?php
                            /* if (has_category()) {
                                 $post_categories = wp_get_post_categories( get_the_ID() );
                                 $cats = array();
                                 }
                                 echo '.';
                             } */
-                            ?> 
+                            ?>
                        <!-- </footer> -->
                     </article>
                 </div>
                 <p><?php _e('Sorry, no results were found.');?></p>
             </div><!-- /#post-404 -->
             <?php endif;?>
-        </div>
-
-            <?php } ?> 
+            <?php } ?>
+                </div><!-- #blog-posts-over -->
           <?php get_template_part('parts/blog-sidebar-r'); ?>
-    </div>
-    
-    </div>
+    </div><!-- .row -->
+
+    </div><!-- #content-wrapper -->
     <?php get_footer(); ?>