-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
executable file
·40 lines (37 loc) · 1.04 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
<?php get_header(); ?>
<div class="post-header search-header">
<h1 class="post-title">
<?php
global $wp_query;
$total_results = $wp_query->found_posts;
$s = htmlentities( $s );
if ( $total_results ) {
printf( esc_html( _n( '%1$d search result for "%2$s"', '%1$d search results for "%2$s"', $total_results, 'chosen' ) ), $total_results, $s );
} else {
printf( esc_html__( 'No search results for "%s"', 'chosen' ), $s );
}
?>
</h1>
<?php get_search_form(); ?>
</div>
<div id="loop-container" class="loop-container">
<?php
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
get_template_part( 'content', 'archive' );
endwhile;
endif;
?>
</div>
<?php the_posts_pagination();
// only display bottom search bar if there are search results
$total_results = $wp_query->found_posts;
if ( $total_results ) {
?>
<div class="search-bottom">
<p><?php esc_html_e( "Can't find what you're looking for? Try refining your search:", "chosen" ); ?></p>
<?php get_search_form(); ?>
</div>
<?php }
get_footer();