-
Notifications
You must be signed in to change notification settings - Fork 34
/
search.php
66 lines (57 loc) · 1.81 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
65
66
<?php
/**
* The template for displaying search results pages.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
*
* @package Freeshifter
*/
get_header(); ?>
<main class="py-8 lg:py-24" style="min-height: 100vh;">
<section class="container mx-auto relative z-10">
<?php
if ( have_posts() ) :
printf( '<h1 class="text-center mb-8">Search Results for: %s</h1>',
esc_html( get_search_query() )
);
echo '<div class="lg:flex justify-start flex-wrap lg:-mx-4">';
while ( have_posts() ) {
the_post(); ?>
<div class="lg:w-1/3 lg:px-4 mb-8">
<article <?php post_class( 'h-full' ); ?> itemscope itemtype="https://schema.org/CreativeWork">
<a class="card-link h-full bg-light-2" rel="bookmark" href="<?= esc_url( get_the_permalink() ); ?>">
<header>
<?php
if( has_post_thumbnail() ) {
the_post_thumbnail( 'thumbnail', [
'class' => 'shadow-lg rounded-full float-right ml-2 mb-2 w-1/4'
]);
}
?>
<div class="text-left relative z-10">
<h2 class="card-title text-h4 font-bold m-0" itemprop="headline"><?= get_the_title(); ?></h2>
<p class="text-sm italic mt-2">
<time class="<?= is_singular('page') ? 'hidden' : ''; ?>" itemprop="datePublished" datetime="<?= get_the_date( 'c' ); ?>">Published on <?= get_the_date( 'F j, Y'); ?></time>
</p>
</div>
</header>
<?php
printf( '<div class="article text-sm text-left">%s</div>',
get_the_excerpt()
); ?>
</a>
</article>
</div>
<?php
}
echo '</div>';
the_posts_navigation();
else :
printf( 'Sorry, no results for %s',
esc_html( get_search_query() )
);
endif; ?>
</section>
</main>
<?php
get_footer();