-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsearch.php
64 lines (58 loc) · 2.26 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
get_header();
?>
<body <?php body_class(); ?>>
<div id="q-app">
<q-layout :view="qwpDataLayoutView">
<?php get_template_part('components/quasarwp', 'layout'); ?>
<!-- %d result found. -->
<!-- No results.
Search Results
Search results for “%s” -->
<q-page-container>
<q-page padding class="qwp-search">
<div class="q-px-xl">
<?php
global $query_string;
$query_args = explode("&", $query_string);
$search_query = array();
foreach ($query_args as $key => $string) {
$query_split = explode("=", $string);
$search_query[$query_split[0]] = urldecode($query_split[1]);
}
$the_query = new WP_Query($search_query);
?>
<q-card class="q-my-md">
<q-card-section>
<p class="text-h4 text-weight-light q-pt-md"><?php echo esc_html(__('Search Results', 'quasarwp')) . ': "' . esc_html($search_query['s']) . '"' ?></p>
<q-separator></q-separator>
<p class="text-caption q-pt-md text-right">
<?php
$escapedFoundedResult = sprintf(
/* translators: number of results */
_n('%d result found.', '%d results found.', $the_query->found_posts, 'quasarwp'),
$the_query->found_posts
);
echo esc_html($escapedFoundedResult);
?>
</p>
</q-card-section>
</q-card>
<?php if ($the_query->have_posts()) : ?>
<?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
<?php get_template_part('components/layout/posts', 'stacked'); ?>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<q-card class="q-my-md">
<q-card-section>
<p class="text-h5 text-weight-light q-pt-md"><?php esc_attr_e('No results.', 'quasarwp') ?> :(</p>
</q-card-section>
</q-card>
<?php endif; ?>
</div>
</q-page>
</q-page-container>
</q-layout>
</div>
<?php get_footer(); ?>