Advertisement
mrengy

search.php

Jul 25th, 2011
2,421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.86 KB | None | 0 0
  1. <?php include(TEMPLATEPATH."/rich.inc.php"); get_header(); ?>
  2. <?php include(TEMPLATEPATH."/header_includes.php");?>
  3. <!-- Begin search.php -->
  4. <div id="wrapper">
  5.     <div id="page-title-container" class="container_12 containermargin">
  6.             <div class="grid_12">
  7.                 <h1 class="entry-title"><?php printf( __( 'Search Results for: %s', 'richwp' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
  8.             </div>
  9.     </div>
  10.     <div class="container_12 containermargin">
  11.             <div id="content" class="grid_8">
  12.                 <hr />
  13.             <?php
  14.                 global $query_string;
  15.  
  16.                 $query_args = explode("&", $query_string);
  17.                 $search_query = array();
  18.  
  19.                 foreach($query_args as $key => $string) {
  20.                     $query_split = explode("=", $string);
  21.                     $search_query[$query_split[0]] = $query_split[1];
  22.                 } // foreach
  23.  
  24.                 $search_wp_query = new WP_Query($search_query);
  25.             ?>
  26.            
  27.             <?php if (have_posts()) : ?>
  28.             <?php
  29.                 //$search_query = new WP_Query('orderby=date&order=DESC&paged=' . $paged);
  30.                 while ($search_wp_query->have_posts()) : $search_wp_query->the_post();
  31.             ?>     
  32.                 <div class="post_content" id="post-<?php the_ID(); ?>">
  33.                     <?php // Hack to highlight search results - see http://www.problogdesign.com/wordpress/3-codes-for-a-far-better-wordpress-search-page/ ?>
  34.                     <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Link to <?php the_title_attribute(); ?>" alt="Link to <?php the_title_attribute(); ?>"><?php $title = get_the_title(); $keys= explode(" ",$s); $title = preg_replace('/('.implode('|', $keys) .')/iu', '<span class="search_highlight">\0</span>', $title); ?>
  35.                     <?php echo $title; ?></a></h2>
  36.                    
  37.                     <?php
  38.                     /*
  39.                     $excerpt = get_the_excerpt(); $excerpt = preg_replace('/('.implode('|', $keys) .')/iu', '<span class="search_highlight">\0</span>', $excerpt);
  40.                     */
  41.                     ?>
  42.                     <?php //echo $excerpt;
  43.                     ?>
  44.                     <?php the_excerpt();?>
  45.                 </div>
  46.                 <?php endwhile;?>
  47.  
  48.                 <?php /* Display navigation to next/previous pages when applicable  */ ?>
  49.                 <div id="nav-below" class="meta-nav navigation navigationboxes">
  50.                 <?php
  51.                     if(function_exists('wp_pagenavi')) {
  52.                         wp_pagenavi( array(
  53.                             'query' =>$search_wp_query  
  54.                         ));
  55.                     }
  56.                 ?>
  57.                 </div><!-- #nav-below -->
  58.                 <?php else: ?>
  59.                     Sorry, no results found. Try broadening your search.
  60.                     <!-- begin search box -->
  61.                     <form method="get" id="searchform-header" action="<?php echo home_url(); ?>" >
  62.                         <ins>
  63.                             <input type="text" class="searchbox"  name="s" id="search-body"  value="Search" onfocus="this.value=(this.value=='Search') ? '' : this.value;" onblur="this.value=(this.value=='') ? 'Search' : this.value;"/>
  64.                         </ins>
  65.                     </form>
  66.                     <!-- end search box -->
  67.                 <?php endif; ?>
  68.             </div>
  69.             <div class="grid_4">
  70.                 <?php get_sidebar();?>
  71.             </div>
  72.     </div>
  73. </div><!-- #wrapper -->
  74. <!-- End search.php -->
  75. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement