Working Search

mgibbs189

{{gist file=”working-search.php” lang=”php”}}
<?php get_header(); ?>
<main id=”main” class=”body__content main” role=”main”>
<div class=”content__main”>
<div class=”content__adv-search”>
<h3 class=”content__adv-search–title”>Refine Your Search</h3>
<?php //echo do_shortcode( ‘‘ );?>
<p class=”content__adv-search–subtitle”>Show me only results from:</p>
<?php //echo do_shortcode( ‘‘ );?>
</div>
<header class=”page__header”>
<h2 class=”page__title” id=”section-heading”>
Search Results for: <?php echo get_search_query(); ?>
</h2>
</header>

<div class=”facetwp-template”>
<?php
//echo do_shortcode( ‘‘ );
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
$post_type = str_replace( array( ‘-‘,’_’ ), ‘ ‘, $post->post_type );
$adv_filter_text = ( $post_type ? ‘<a href=”‘ . get_the_permalink() . ‘” class=”button__three”>’ . $post_type . ‘</a>’ : ” );
?>
<article id=”post-<?php the_ID(); ?>” <?php post_class(‘entry__search-results article__entries–border’); ?> aria-labelledby=”section-heading-<?php the_ID(); ?>” role=”article”>
<header class=”entry__header”>
<h3 class=”entry__title” id=”section-heading-<?php the_ID(); ?>”>
<?php echo $adv_filter_text; ?>
<a href=”<?php the_permalink(); ?>” rel=”bookmark”>
<?php the_title(); ?>
</a>
</h3>
</header>
<section class=”entry__content”>
<?php the_excerpt(); ?>
</section>
</article>
<?php
endwhile;
fcwp_pagination( $type = ‘numbered’, array( ‘end_size’ => 3, ‘type’ => ‘plain’ ) );
else :
?>
<h2>
<?php _e( ‘Sorry, but nothing matched your search criteria. Please try again with some different keywords’, ‘fcwp’ ); ?>
</h2>
<?php endif; ?>
</div>
<?php get_sidebar( ‘left’ ); ?>
</main>
<?php get_footer();
{{/gist}}