-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
55 lines (40 loc) · 1.83 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
50
51
52
53
54
55
<?php
/**
* The template for displaying search results pages.
*
*
*/
get_header();
get_template_part('templates/page/page', 'logo');
?>
<?php global $wp_query; $total_results = $wp_query->found_posts; ?>
<!-- Content Section -->
<section>
<div class="container">
<div class="row">
<div class="col-md-<?php if (is_active_sidebar('sidebar')) : ?>9<?php else : ?>12<?php endif; ?>">
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h1 class="section-heading">
<?php
// get the number of search results. If 1, use singular 'result'. Else use plural 'results'
global $wp_query;
if ($wp_query->found_posts == 1) {
echo $wp_query->found_posts . ' Result Found';
} else {
echo $wp_query->found_posts . ' Results Found';
}
?>
</h1>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?><br>
<span class="search-post-title"><?php the_title('<h3>','</h3>'); ?></span>
<span class="search-post-excerpt"><?php the_excerpt(); ?></span>
<span class="search-post-link"><a href="<?php the_permalink(); ?>"><?php the_permalink(); ?></a></span><br>
<?php endwhile; ?>
</div>
</div><!-- col -->
<?php get_sidebar(); ?>
</div><!-- row -->
</div><!-- container -->
</section><!-- section -->
<?php get_footer(); ?>