wp-73k/search.php

67 lines
2.1 KiB
PHP
Raw Normal View History

2019-05-23 12:30:31 -04:00
<?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;">
2021-07-04 18:16:33 -04:00
<section class="container mx-auto relative z-10">
<?php
if ( have_posts() ) :
2019-05-23 12:30:31 -04:00
2021-07-04 18:16:33 -04:00
printf( '<h1 class="text-center mb-8">Search Results for: %s</h1>',
esc_html( get_search_query() )
);
2019-05-23 12:30:31 -04:00
2021-07-04 18:16:33 -04:00
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>';
2019-05-23 12:30:31 -04:00
2021-07-04 18:16:33 -04:00
the_posts_navigation();
2019-05-23 12:30:31 -04:00
2021-07-04 18:16:33 -04:00
else :
2019-05-23 12:30:31 -04:00
2021-07-04 18:16:33 -04:00
printf( 'Sorry, no results for %s',
esc_html( get_search_query() )
);
2019-05-23 12:30:31 -04:00
2021-07-04 18:16:33 -04:00
endif; ?>
</section>
2019-05-23 12:30:31 -04:00
</main>
<?php
get_footer();