Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Last active June 28, 2016 19:50
Show Gist options
  • Save mgibbs189/78178af1abc0ac6baf502f39e0f86c00 to your computer and use it in GitHub Desktop.
Save mgibbs189/78178af1abc0ac6baf502f39e0f86c00 to your computer and use it in GitHub Desktop.
Working Search
<?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( '[facetwp facet="advanced_search"]' );?>
<p class="content__adv-search--subtitle">Show me only results from:</p>
<?php //echo do_shortcode( '[facetwp facet="refine_results"]' );?>
</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( '[facetwp template="search"]' );
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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment