Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created August 12, 2014 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchristopher/34161c7acd6675ae504e to your computer and use it in GitHub Desktop.
Save jchristopher/34161c7acd6675ae504e to your computer and use it in GitHub Desktop.
SearchWP Live Ajax Search bbPress pre-search results template
<p class="searchwp-pre-qualify">
<strong>Please try these resources before creating a new ticket:</strong>
</p>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php $post_type = get_post_type_object( get_post_type() ); ?>
<div class="searchwp-live-search-result">
<p><a href="<?php echo esc_url( get_permalink() ); ?>">
<?php the_title(); ?> (<?php echo esc_html( $post_type->labels->singular_name ); ?>) &raquo;
</a></p>
</div>
<?php endwhile; ?>
<?php endif; ?>
<p class="searchwp-nothing-applicable">
<a href="#">Nothing Here Helps, Create Ticket &raquo;</a>
</p>
<script type="text/javascript">
jQuery(document).ready(function($){
$('.searchwp-nothing-applicable a').click(function(){
$('.searchwp-pre-ticket,.searchwp-live-search-results').remove();
$('.searchwp-pre-ticket-hide').removeClass('searchwp-pre-ticket-hide');
return false;
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment