|
1 <?php |
|
2 /** |
|
3 * The template for displaying search results pages |
|
4 * |
|
5 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result |
|
6 * |
|
7 * @package WordPress |
|
8 * @subpackage Twenty_Seventeen |
|
9 * @since 1.0 |
|
10 * @version 1.0 |
|
11 */ |
|
12 |
|
13 get_header(); ?> |
|
14 |
|
15 <div class="wrap"> |
|
16 |
|
17 <header class="page-header"> |
|
18 <?php if ( have_posts() ) : ?> |
|
19 <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyseventeen' ), '<span>' . get_search_query() . '</span>' ); ?></h1> |
|
20 <?php else : ?> |
|
21 <h1 class="page-title"><?php _e( 'Nothing Found', 'twentyseventeen' ); ?></h1> |
|
22 <?php endif; ?> |
|
23 </header><!-- .page-header --> |
|
24 |
|
25 <div id="primary" class="content-area"> |
|
26 <main id="main" class="site-main" role="main"> |
|
27 |
|
28 <?php |
|
29 if ( have_posts() ) : |
|
30 /* Start the Loop */ |
|
31 while ( have_posts() ) : the_post(); |
|
32 |
|
33 /** |
|
34 * Run the loop for the search to output the results. |
|
35 * If you want to overload this in a child theme then include a file |
|
36 * called content-search.php and that will be used instead. |
|
37 */ |
|
38 get_template_part( 'template-parts/post/content', 'excerpt' ); |
|
39 |
|
40 endwhile; // End of the loop. |
|
41 |
|
42 the_posts_pagination( array( |
|
43 'prev_text' => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text">' . __( 'Previous page', 'twentyseventeen' ) . '</span>', |
|
44 'next_text' => '<span class="screen-reader-text">' . __( 'Next page', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ), |
|
45 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyseventeen' ) . ' </span>', |
|
46 ) ); |
|
47 |
|
48 else : ?> |
|
49 |
|
50 <p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'twentyseventeen' ); ?></p> |
|
51 <?php |
|
52 get_search_form(); |
|
53 |
|
54 endif; |
|
55 ?> |
|
56 |
|
57 </main><!-- #main --> |
|
58 </div><!-- #primary --> |
|
59 <?php get_sidebar(); ?> |
|
60 </div><!-- .wrap --> |
|
61 |
|
62 <?php get_footer(); |