[gnomeweb-wp] created specific content to show when no results are found in search



commit 1d22edb5c1c63c8e989dc74ccdb37757cffa6add
Author: Vinicius Depizzol <vdepizzol gmail com>
Date:   Thu Sep 9 00:52:59 2010 -0300

    created specific content to show when no results are found in search

 wp-content/themes/gnome-grass/header.php           |    2 +-
 .../images/footer_arts/search_no-results.png       |  Bin 0 -> 3990 bytes
 wp-content/themes/gnome-grass/search.php           |   87 +++++++++++++++----
 3 files changed, 69 insertions(+), 20 deletions(-)
---
diff --git a/wp-content/themes/gnome-grass/header.php b/wp-content/themes/gnome-grass/header.php
index cb80d2d..1250d4f 100644
--- a/wp-content/themes/gnome-grass/header.php
+++ b/wp-content/themes/gnome-grass/header.php
@@ -45,7 +45,7 @@
             <div class="right">
                 <form role="search" method="get" id="searchform" action="<?php bloginfo('url'); ?>/" >
                     <div>
-                        <label class="hidden" for="s"><?php _e( 'Search', 'grass' ); ?>: </label><input type="text" value="<?php if(isset($_GET['s'])) { echo htmlentities(strip_tags($_GET['s'])); } ?>" name="s" id="s" placeholder="<?php _e( 'Search', 'grass' ); ?>" />
+                        <label class="hidden" for="s"><?php _e( 'Search', 'grass' ); ?>: </label><input type="text" value="<?php if(isset($_GET['s'])) { echo htmlspecialchars(stripslashes(strip_tags($_GET['s']))); } ?>" name="s" id="s" placeholder="<?php _e( 'Search', 'grass' ); ?>" />
                     </div>
                 </form>
             </div>
diff --git a/wp-content/themes/gnome-grass/images/footer_arts/search_no-results.png b/wp-content/themes/gnome-grass/images/footer_arts/search_no-results.png
new file mode 100644
index 0000000..ef790c7
Binary files /dev/null and b/wp-content/themes/gnome-grass/images/footer_arts/search_no-results.png differ
diff --git a/wp-content/themes/gnome-grass/search.php b/wp-content/themes/gnome-grass/search.php
index 0de70e6..8f22f81 100644
--- a/wp-content/themes/gnome-grass/search.php
+++ b/wp-content/themes/gnome-grass/search.php
@@ -9,30 +9,79 @@ require_once("header.php"); ?>
     <!-- container -->
     <div id="container" class="two_columns">
         <div class="container_12">
-        
-            <div class="page_title">
-                <h1><?php _e( 'Looking for', 'grass' ); ?> <em><?php echo htmlentities(strip_tags($_GET['s']));?></em>...</h1>
-            </div>
-            
-            <div class="content without_sidebar">
-                <dl>
-                <?php while ( have_posts() ) : the_post(); ?>
-                    <dt><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></dt>
-                    <dd><?php the_excerpt(); ?></dd>
-                <?php endwhile; // End the loop. Whew. ?>
-                </dl>
+
+            <?php if ( have_posts() ) : ?>
+                <div class="page_title">
+                    <h1><?php _e( 'Looking for', 'grass' ); ?> <em><?php echo htmlentities(strip_tags($_GET['s']));?></em>...</h1>
+                </div>
                 
-                <?php if (  $wp_query->max_num_pages > 1 ) : ?>
-                <div class="page_navigation">
-                    <span class="prev"><?php previous_posts_link(__('Previous page', 'grass')); ?></span>
-                    <span class="next"><?php next_posts_link(__('Next page', 'grass')); ?></span>
+                <div class="content">
+                    <dl>
+                    <?php while ( have_posts() ) : the_post(); ?>
+                        <dt><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></dt>
+                        <dd><?php the_excerpt(); ?></dd>
+                    <?php endwhile; // End the loop. Whew. ?>
+                    </dl>
+                    
+                    <?php if (  $wp_query->max_num_pages > 1 ) : ?>
+                    <div class="page_navigation">
+                        <span class="prev"><?php previous_posts_link(__('Previous page', 'grass')); ?></span>
+                        <span class="next"><?php next_posts_link(__('Next page', 'grass')); ?></span>
+                        <div class="clear"></div>
+                    </div>
+                    <?php endif; ?>
                     <div class="clear"></div>
                 </div>
-                <?php endif; ?>
                 
-                <div class="clear"></div>
+                <div class="sidebar">
+                    &nbsp;
+                </div>
+                
+            <?php else : ?>
+            
+                <div class="content without_sidebar">
+                    
+                    <div class="grid_10 alpha prefix_1 omega suffix_1">
+                    
+                        <p><?php get_search_form(); ?></p>
+                        
+                        <hr />
+                    
+                        <h2><?php _e( 'Sorry, but nothing was found.', 'grass' ); ?></h2>
+                        
+                        <p><?php _e( 'Suggestions:', 'grass' ); ?></p>
+                        
+                        <ul>
+                            <li><?php _e( 'Make sure all words are spelled correctly.', 'grass' ); ?></li>
+                            <li><?php _e( 'Try different keywords.', 'grass' ); ?></li>
+                            <li><?php _e( 'Try fewer keywords.', 'grass' ); ?></li>
+                        </ul>
+                        
+                        <p>
+                        <?php
+                        printf(
+                                __( 'If you feel lost, you may want to search for %1$s in all GNOME websites on %2$s.', 'grass'),
+                                'â??'.htmlspecialchars(stripslashes(strip_tags($_GET['s']))).'â??',
+                                '<a href="http://google.com/search?q='.htmlspecialchars(stripslashes(strip_tags($_GET['s']))).'%20site:gnome.org">Google</a>'
+                            );
+                        ?>
+                        </p>
+                        
+                        <!-- Never to get lost is not to live. -->
+                        
+                    </div>
+                    <div class="clear"></div>
+                    
             </div>
-            <?php $footer_art = 'search'; ?>
+            <?php endif; ?>
+            
+            <?php
+            if ( have_posts() ) :
+                $footer_art = 'search';
+            else:
+                $footer_art = 'search_no-results';
+            endif;
+            ?>
             <?php require_once("footer_art.php"); ?>
         </div>
     </div>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]