-
Notifications
You must be signed in to change notification settings - Fork 2
/
search.php
45 lines (33 loc) · 1.14 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
<?php get_header(); ?>
<?php
global $wp_query;
$count = $wp_query->post_count;
$key = get_search_query();
if( get_query_var( 'error--search-term-length' ) ) {
$message = sprintf( __( 'You search term has to have at least 3 characters.', 'port-f' ) );
} elseif( $count == 1 ) {
$message = sprintf( __( 'There is one search result for <em>%1$s.</em>', 'port-f' ), esc_html( $key ) );
} elseif( $count > 1 ) {
$message = sprintf( __( 'There are %1$s search results for <em>%2$s.</em>', 'port-f' ), esc_html( $count ), esc_html( $key ) );
} else {
$message = sprintf( __( 'Sorry, we couldn't find anything that matches <em>%1$s.</em>', 'port-f' ), esc_html( $key ) );
}
get_search_form();
?>
<p class="Posts-message PostsResults-message">
<?php echo $message; ?>
</p>
<section class="Posts PostsResults">
<?php
if( have_posts() ) {
while( have_posts() ) {
the_post();
getPart( 'Post', get_post_type(), true );
}
getPart( 'Pagination' );
} else {
getPart( 'Post', 'none', true );
}
?>
</section>
<?php get_footer(); ?>