-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
50 lines (40 loc) · 1.05 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
<?php
/**
* The template for displaying search results pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
*
* @package Wordtrap
* @since wordtrap 1.0.0
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
$post_type = ( isset( $_GET['post_type'] ) && $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : null;
if ( isset( $post_type ) && locate_template( 'archive-' . $post_type . '.php' ) ) {
get_template_part( 'archive', $post_type );
exit;
}
get_header();
?>
<?php if ( have_posts() ) : ?>
<?php
// Start the Loop.
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content/content', 'search' );
endwhile;
?>
<footer class="page-navigation">
<?php
// Previous/next page navigation.
wordtrap_the_posts_navigation();
?>
</footer><!-- .page-navigation -->
<?php
else :
// If no content, include the "No posts found" template.
get_template_part( 'template-parts/content/content', 'none' );
endif;
?>
<?php
get_footer();