Rss Feed
  1. Search page in Wordpress

    Monday, 25 February 2013


     <div id="content" class="clearfix">
    
                <div id="main" class="col700 left clearfix" role="main">
    
                    <h1 class="archive_title"><span>Search Results for:</span> <?php echo esc_attr(get_search_query()); ?></h1>
    
                    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
                    <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?>>
    
                        <header>
    
                            <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
    
                            <p class="meta"><?php _e("Posted", "bonestheme"); ?> <time datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time('F jS, Y'); ?></time> <?php _e("by", "bonestheme"); ?> <?php the_author_posts_link(); ?> <span class="amp">&</span> <?php _e("filed under", "bonestheme"); ?> <?php the_category(', '); ?>.</p>
    
                        </header> <!-- end article header -->
    
                        <section class="post_content">
                            <?php the_excerpt('<span class="read-more">Read more on "'.the_title('', '', false).'" &raquo;</span>'); ?>
    
                        </section> <!-- end article section -->
    
                        <footer>
    
    
                        </footer> <!-- end article footer -->
    
                    </article> <!-- end article -->
    
                    <?php endwhile; ?>  
    
                    <?php if (function_exists('page_navi')) { // if expirimental feature is active ?>
    
                        <?php page_navi(); // use the page navi function ?>
    
                    <?php } else { // if it is disabled, display regular wp prev & next links ?>
                        <nav class="wp-prev-next">
                            <ul class="clearfix">
                                <li class="prev-link"><?php next_posts_link(_e('&laquo; Older Entries', "bonestheme")) ?></li>
                                <li class="next-link"><?php previous_posts_link(_e('Newer Entries &raquo;', "bonestheme")) ?></li>
                            </ul>
                        </nav>
                    <?php } ?>          
    
                    <?php else : ?>
    
                    <!-- this area shows up if there are no results -->
    
                    <article id="post-not-found">
                        <header>
                            <h1>No Results Found</h1>
                        </header>
                        <section class="post_content">
                            <p>Sorry, but the requested resource was not found on this site.</p>
                        </section>
                        <footer>
                        </footer>
                    </article>
    
                    <?php endif; ?>
    
                </div> <!-- end #main -->
    
                <div id="sidebar1" class="sidebar right col220">
    
                    <?php get_search_form(); ?>
    
    
    
                </div>
    
            </div> <!-- end #content -->
    This is with empty search result will return to homepage
    Refer: http://wordpress.stackexchange.com/questions/29516/empty-search-returns-home-page-how-to-return-not-found-search-page

  2. 0 comments:

    Post a Comment