Relevanssi search not working on custom search
-
Hello!
Right now the relevanssi search is not working. Im not really sure what i need to switch wp_query with. Right now i want it to search by _skus also. The admin search works but on frontend it doesn’t.search.php is following.
get_header(); ?> <?php global $query_string; $big = 999999; $query_args = explode("&", $query_string); $search_query = array( 's' => 'keyword' ); foreach($query_args as $key => $string) { $query_split = explode("=", $string); $search_query[$query_split[0]] = urldecode($query_split[1]); } // foreach $the_query = new WP_Query($search_query); if ( $the_query->have_posts() ) : ?> <!-- the loop --> <?php global $wp_query; $total_results = $wp_query->found_posts; ?> <div id="pageContent"> <div class="container"> <div class="row"> <div class="col-12"> <p class="lead text-center"><?php esc_html_e( 'Leidsime kokku ', 'brandweb-child'); ?> <strong><?php echo $total_results; ?></strong> <?php esc_html_e( 'otsingutulemused', 'brandweb-child'); ?>.</p> </div> </div> <div class="row d-flex align-items-stretch"> <?php while ( $the_query->have_posts() ) : $the_query->the_post(); get_template_part('library/partials/blog/regular-blog-layout'); endwhile; ?> <div class="col-12 mt-md-5 mt-3"> <?php echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'total' => $wp_query->max_num_pages ) ); ?> </div> </div> </div> </div> <?php wp_reset_postdata(); ?> <?php else : ?> <div id="pageContent"> <div class="container"> <div class="row"> <div class="col-12"> <p><?php esc_html_e( 'Teie otsingul ei olnud tulemusi.', 'brandweb-child'); ?>.</p> <p><?php esc_html_e( 'Proovige uuesti m?ne muu m?rks?naga', 'brandweb-child' ); ?></p> <?php get_search_form(); ?> </div> </div> </div> </div> <?php endif; ?> <?php get_footer(); ?>
Looking forward for the help!
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Relevanssi search not working on custom search’ is closed to new replies.