-
Notifications
You must be signed in to change notification settings - Fork 1
/
search.php
57 lines (46 loc) · 1.07 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
56
57
<?php
/**
* The main template file for displaying the Search results
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package cliowp
*/
$results = new WP_Query( "s=$s&showposts=-1" );
$count_results = $results->post_count;
wp_reset_postdata();
?>
<?php get_header(); ?>
<h1><?php esc_html_e( 'Search results', 'cliowp' ); ?>
</h1>
<?php if ( trim( get_search_query() ) ) : ?>
<h2><?php esc_html_e( 'Search query', 'cliowp' ) . ':'; ?>
“<?php echo esc_html( get_search_query() ); ?>”</h2>
<?php if ( $count_results ) : ?>
<h3>
<?php
esc_html_e( 'Results', 'cliowp' );
echo ':';
?>
<?php echo wp_kses_post( $count_results ); ?>
</h3>
<?php else : ?>
<h3>
<?php
esc_html_e( 'No results for this query', 'cliowp' );
echo '...';
?>
</h3>
<?php endif; ?>
<?php get_template_part( 'template-parts/famous-wordpress-loop' ); ?>
<p><?php echo wp_kses_post( paginate_links() ); ?></p>
<?php else : ?>
<h3>
<?php
esc_html_e( 'Please enter a search term', 'cliowp' );
echo '...';
?>
</h3>
<?php endif; ?>
<?php
get_footer();