Created
May 31, 2016 05:10
-
-
Save jpen365/a8e86f08c5061b4b9983479195666680 to your computer and use it in GitHub Desktop.
AJAX WP Advanced Search Results Template
This file contains hidden or 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 | |
/* | |
* template-ajax-results.php | |
* This file should be created in the root of your theme directory | |
* See http://wpadvancedsearch.com to learn more | |
*/ | |
if ( have_posts() ) : | |
while ( have_posts() ) : the_post(); | |
$post_type = get_post_type_object($post->post_type); | |
?> | |
<article> | |
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4> | |
<p class="info"><strong>Post Type:</strong> <?php echo $post_type->labels->singular_name; ?> <strong>Date added:</strong> <?php the_time('F j, Y'); ?></p> | |
<?php the_excerpt(); ?> | |
</article> | |
<?php | |
endwhile; | |
else : | |
echo '<p>Sorry, no results matched your search.</p>'; | |
endif; | |
wp_reset_query(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment