-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.php
More file actions
68 lines (60 loc) · 2.18 KB
/
search.php
File metadata and controls
68 lines (60 loc) · 2.18 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
<?php
/**
* The template for displaying search results pages.
*/
get_header();
?>
<article>
<header class="entry-content entry-header alignwide">
<h1>
<?php
$numberOfPosts = (int)$wp_query->found_posts;
printf(
esc_html(
/* translators: %d: The number of search results. */
_n(
'We found %1$s result for your search "%2$s".',
'We found %1$s results for your search "%2$s".',
$numberOfPosts,
'soyes'
)
),
'<span class="search-term">' . $numberOfPosts . '</span>',
'<span class="search-term">' . esc_html(get_search_query()) . '</span>'
);
?>
</h1>
</header><!-- .entry-header -->
<div class="entry-content">
<?php get_search_form(); ?>
<?php if (!have_posts()) : ?>
<h2><?php esc_html_e('Wanna try another search? 🍀', 'soyes'); ?></h2>
<div>
<?php get_template_part('template-parts/elements/return-categories'); ?>
</div>
<?php else: ?>
<div class="cards">
<?php
while (have_posts()) :
the_post();
get_template_part('template-parts/elements/card');
endwhile;
?>
</div><!-- .cards -->
<?php endif; ?>
</div><!-- .entry-content -->
<footer class="entry-footer default-max-width">
<?php
wp_link_pages(
array(
'before' => '<nav class="page-links" aria-label="' . esc_attr__('Page', 'soyes') . '">',
'after' => '</nav>',
/* translators: %: Page number. */
'pagelink' => esc_html__('Page %', 'soyes'),
)
);
?>
</footer><!-- .entry-footer -->
</article>
<?php
get_footer();