-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsearch.php
More file actions
41 lines (36 loc) · 1.07 KB
/
search.php
File metadata and controls
41 lines (36 loc) · 1.07 KB
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
<?php get_header(); ?>
<div class="page">
<main id="main" class="site-main" role="main">
<?php
$search_string = esc_html(get_search_query());?>
<h2 class="text-center question-topic">Search Results</h2>
<h5 id="searchedfor">Searched for: "<?php echo $search_string;?>"</h5>
<?php get_sidebar('widgety-top'); ?>
<?php
if ( have_posts() ) :
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
'paged' => $paged,
'post_type' => 'post',
'posts_per_page' => get_option('posts_per_page'),
's' => $search_string
);
$the_query = new WP_Query($args);
include('list-of-posts.php'); ?>
<?php else: ?>
<div class="row">
<div class="col-lg-8 col-md-7 middle-panel-rise">
<div class="text-center question-topic">
<h3>Nothing found!</h3>
</div>
<hr/>
<?php endif; wp_reset_postdata();?>
</div>
<div class="col-lg-4 col-md-5">
<?php get_sidebar();?>
<?php get_sidebar('footer');?>
</div>
</div>
</main><!-- .site-main -->
</div>
<?php get_footer(); ?>