-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
49 lines (35 loc) · 1.36 KB
/
search.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* @package WordPress
* @subpackage Default_Theme
*/
get_header(); ?>
<div id="content" class="narrowcolumn">
<?php if (have_posts()) : ?>
<?php $keys= explode(" ",$s); ?>
<h2 class="pagetitle">Search Results for "<em style="color: #666;"><?php echo $s; ?></em>"</h2>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('« More Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Previous Entries »') ?></div>
</div>
<?php while (have_posts()) : the_post(); ?>
<div <?php post_class() ?>>
<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
<?php
$excerpt = get_the_excerpt();
$excerpt = preg_replace('/('.implode('|', $keys) .')/iu', '<strong class="search-excerpt">\0</strong>', $excerpt);
?>
<?php echo $excerpt; ?>
</div>
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('« More Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Previous Entries »') ?></div>
</div>
<?php else : ?>
<h2 class="center">No posts found. Try a different search?</h2>
<?php get_search_form(); ?>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>