-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsearch.php
More file actions
114 lines (97 loc) · 2.94 KB
/
search.php
File metadata and controls
114 lines (97 loc) · 2.94 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
/*
* The template for displaying search results.
*/
get_header();
?>
<div class="wrapper">
<section class="single-hero-section" style="">
<div class="container">
<div class="row">
<div class="col-12">
<div class="section-title">
<h1><?php echo __('Search results for: ', 'nextcloud'); ?><?php echo '<green>' . get_search_query() . '</green>'; ?></h1>
</div>
</div>
</div>
</section>
<section class="blog-section">
<div class="container">
<div class="row search-row">
<div class="col-lg-4"></div>
<?php
if (function_exists('wpes_search_form')) {
$search_id = isset($_GET['wpessid']) ? $_GET['wpessid'] : 1612;
echo '<div class="col-lg-4">';
echo '<div class="form-holder">';
wpes_search_form(array(
'wpessid' => $search_id
));
echo '</div>';
echo '</div>';
}
?>
<div class="col-lg-4"></div>
</div>
<div class="row row-list-blog">
<?php
$default_posts_per_page = get_option( 'posts_per_page' ); // should be 9
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
echo '<div class="post_type" style="display:none;">';
print_r($post_type);
echo "</div>";
$limit = $default_posts_per_page;
$search_query = new WP_Query(array(
'post_type' => array($post_type),
'posts_per_page' => $default_posts_per_page,
's' => get_search_query(),
'post_status' => array('publish'),
'tag__not_in' => array(269),
'orderby' => 'date',
'order' => 'DESC',
'paged' => $paged,
'category__not_in' => array(226) //exclude Private category
));
$count = $search_query->found_posts;
if ($search_query->have_posts()) {
while ($search_query->have_posts()) {
$search_query->the_post();
get_template_part('inc/blog_loop_single');
}
} else {
echo '<div class="col-12">';
echo '<div class="not-found">';
echo '<h3 class="text-center">'.__('No search results for: ', 'nextcloud') . get_search_query() . '</h3>';
echo '</div>';
echo '</div>';
}
// Restore original Post Data.
wp_reset_postdata();
?>
</div>
<?php
if ($count > $limit) {
?>
<div class="row loadNews_row">
<div class="col-12">
<div class="section-button">
<button class="c-btn btn-main loadNews" data-post-type="<?php
$post_type_search = '';
if(isset($_GET['wpessid'])) {
if($_GET['wpessid'] == 1612) {
$post_type_search = 'post';
} else if($_GET['wpessid'] == 125618) {
$post_type_search = 'event';
} else {
$post_type_search = 'post';
}
}
if(isset($post_type_search)) echo $post_type_search; ?>" data-count="<?php echo $count; ?>" data-limit="<?php echo $limit; ?>" data-search="true" data-category="" id="loadNews"><?php echo __('Load More','nextcloud'); ?></button>
</div>
</div>
</div>
<?php } ?>
</div>
</section>
</div>
<?php get_footer(); ?>