Example #1
0
        the_ID();
        ?>
"> 

								<div class="search-post-title">
									<span class="icon-right-hand"></span> <a href="<?php 
        echo get_permalink();
        ?>
" rel="bookmark"><?php 
        the_title();
        ?>
</a> 				 
								</div><!-- / end div  .post-title-holder -->

								<?php 
        $the_excerpt = rt_search_highlight(trim(get_search_query()), get_the_excerpt());
        echo $the_excerpt;
        ?>

							</article>  

					<?php 
    }
    rt_get_pagination($wp_query);
    wp_reset_query();
} else {
    ?>
					<?php 
    get_template_part('content', 'none');
    ?>
				<?php 
Example #2
0
 function rt_search_highlight($needle, $haystack)
 {
     $ind = stripos($haystack, $needle);
     $len = strlen($needle);
     if ($ind !== false) {
         return substr($haystack, 0, $ind) . '<span class="search_highlight">' . substr($haystack, $ind, $len) . "</span>" . rt_search_highlight($needle, substr($haystack, $ind + $len));
     } else {
         return $haystack;
     }
 }