Last active
September 22, 2020 12:41
-
-
Save msaari/fd754d021223b5ad9b96ca8f601b7030 to your computer and use it in GitHub Desktop.
SearchWP Live Ajax Search template with support for users and taxonomies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Save this as searchwp-live-ajax-search/search-results.php inside your theme. | |
*/ | |
?> | |
<?php if ( have_posts() ) : ?> | |
<?php while ( have_posts() ) : the_post(); if ( 'draft' === $post->post_status ) continue; ?> | |
<?php $post_type = get_post_type_object( get_post_type() ); ?> | |
<div class="searchwp-live-search-result" role="option" id="" aria-selected="false"> | |
<p><a href="<?php echo esc_url( get_permalink() ); ?>"> | |
<?php the_title(); ?> (<?php $label = isset( $post_type->labels ) ? $post_type->labels->singular_name : ucfirst(get_post_type()); echo esc_html( $label ); ?>) » | |
</a></p> | |
</div> | |
<?php endwhile; ?> | |
<?php else : ?> | |
<p class="searchwp-live-search-no-results" role="option"> | |
<em><?php esc_html_x( 'No results found.', 'swplas' ); ?></em> | |
</p> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment