Search Example
<form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
<div><input type="text" size="18" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" class="btn" />
</div>
</form>
<?php
$s=get_search_query();
$args = array(
's' =>$s
);
// The Query
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) { ?>
<section class="post">
<!-- <div class="container"> -->
<div class="my-flex-container height-15v">
<div class="col-md-3 hidden-sm hidden-xs">
</div>
<div class="col-md-9 post-content-load">
<?php _e("<h2 >Search Results for: ".get_query_var('s')."</h2>"); ?>
</div>
</div>
<!-- </div> -->
</section>
<?php while ( $the_query->have_posts() ) {
$the_query->the_post();
?>
<section id="" class="post">
<!-- <div class="container"> -->
<div class="my-flex-container height-auto">
<div class="col-sm-3 post-featured-img">
<img style="" class="post-image" src="<?php the_post_thumbnail_url() ?>" alt="<?php the_title(); ?>">-->
<ul style="z-index:3;position:relative" class="post-overlay">
<li><?php the_time(' F jS, Y'); ?></li>
<li><?php the_category() ?></li>
</ul>
</div>
<div class="col-sm-9 post-content">
<article>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<p><?php the_excerpt(); ?></p>
</article>
<footer>
<a href = "<?php the_permalink(); ?>"class="read-more-news">Go to link</a>
</footer>
</div>
</div>
<!-- </div> -->
</section>
<?php
}
}else{
?>
<section class="post">
<!-- <div class="container"> -->
<div style = "padding-top:5rem;" class="my-flex-container height-15v ">
<div class="col-md-3 hidden-sm hidden-xs">
</div>
<div class="col-md-9 post-content-load">
<h2 style='font-weight:bold;color:#000'>Nothing Found</h2>
<p>Sorry, but nothing matched your search criteria. Please try again with some different keywords.</p>
</div>
</div>
<!-- </div> -->
</section>
<?php } ?>