-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
50 lines (40 loc) · 1.2 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
/*
Template Name: Search
*/
?>
<?php get_header(); ?>
<main>
<!-- Header Search -->
<?php get_template_part('templates/headers/search-header'); ?>
<section>
<?php
$args = array(
'post_type'=>'post',
's'=> get_search_query(),
'posts_per_archive_page' => 10,
'paged' => get_query_var('paged') ? get_query_var('paged') : 1
);
$query = new WP_Query( $args );
if( $query->have_posts() ):
?>
<div>
<?php while( $query->have_posts() ): $query->the_post(); ?>
<?php if( get_post_type() == 'post' ): ?>
<!-- Posts cards -->
<?php endif; ?>
<?php endwhile; wp_reset_postdata(); ?>
</div>
<div class="pagination">
<?php pagination_posts($query); ?>
</div>
<?php else: ?>
<div>
<span>
Nothing found.
</span>
</div>
<?php endif; ?>
</section>
</main>
<?php get_footer(); ?>