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 | |
/** | |
* The template for displaying search results pages. | |
* | |
* @package _s | |
*/ | |
global $query_string; | |
$query_args = explode("&", $query_string); | |
$search_query = array(); | |
foreach($query_args as $key => $string) { | |
$query_split = explode("=", $string); | |
$search_query[$query_split[0]] = urldecode($query_split[1]); | |
} // foreach | |
$search = new WP_Query($search_query); | |
get_header(); ?> | |
<div id="primary" class="contents-search-results"> | |
<main id="main" class="site-main ctn-main" role="main"> | |
<?php if ( have_posts() ) : ?> | |
<header class="page-header"> | |
<h1 class="page-title"><?php printf( esc_html__( 'Search Results', '_s' )); ?></h1> | |
<p class="search-results-numbers"> | |
<?php | |
global $wp_query; | |
$total_results = $wp_query->found_posts; | |
echo ('About <span class="totalnb">' . $total_results . '</span> Results'); | |
?> (<?php echo timer_stop( $display = 0, $precision = 3 ); ?> seconds) | |
</p> | |
</header><!-- .page-header --> | |
<?php /* Start the Loop */ ?> | |
<div class="search-results-ajax"> | |
<?php query_posts('s='.get_search_query(). '&posts_per_page=10&offset=0'); ?> | |
<?php while ( have_posts() ) : the_post(); ?> | |
<?php | |
/** | |
* Run the loop for the search to output the results. | |
* If you want to overload this in a child theme then include a file | |
* called content-search.php and that will be used instead. | |
*/ | |
get_template_part( 'template-parts/content', 'search' ); | |
?> | |
<?php endwhile; ?> | |
</div> | |
<div id="load-more-results" class="load-more"><a href="#" target="_self">More Results<i class="fa fa-angle-down fa-2x"></i></a></a></div> | |
<?php //the_posts_navigation(); ?> | |
<?php else : ?> | |
<?php get_template_part( 'template-parts/content', 'none' ); ?> | |
<?php endif; ?> | |
</main><!-- #main --> | |
</div><!-- #primary --> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment