Forums › Forums › Search & Filter Pro › Search not returning any results anymore.
- This topic has 13 replies, 3 voices, and was last updated 7 years, 6 months ago by Anonymous.
-
Anonymous(Private) May 2, 2017 at 4:05 pm #105987
I have just updated to the most recent version, hoping that it would solve our issue that search was not returning any results, but nothing has changed. If I search using a search term in the keywords field, then things get returned as results, but if i leave the search field blank, and just try to filter using categories / taxonomies, it always returns a “no results” page. Please help!
I tried rebuilding the cache.
I am hosted on WPEngine in case that matters 🙂
Anonymous(Private) May 2, 2017 at 4:15 pm #105996also want to mention that my search.php doesnt have any code that returns false if the search query is empty. I also have this in my functions.php to allow for empty search
function make_blank_search ($query){ global $wp_query; if (isset($_GET['s']) && $_GET['s']==''){ //if search parameter is blank, do not return false $wp_query->set('s',' '); $wp_query->is_search=true; } return $query; } add_action('pre_get_posts','make_blank_search');
Anonymous(Private) May 2, 2017 at 7:29 pm #106045<?php /** * The template for displaying search results pages. * * @package Golden */ get_header(); global $query_string; $searchquery = get_search_query(); ?> <?php $gender = get_taxonomy_values("_sft_gender"); $filter = get_taxonomy_values("_sft_filter"); $collection = get_taxonomy_values("_sft_collection"); $style = get_taxonomy_values("_sft_style"); $fit =get_taxonomy_values("_sft_fit"); // if($collection){ // $collection_final = str_replace('-', ' ', $collection->slug); // } ?> <?php include('inc/filter-bar-new.php'); ?> <div id="primary" class="content-area"> <main id="main" class="site-main product-archives" role="main"> <?php if ( have_posts() ) : ?> <?php $search_new = esc_html($wp_query->query['s']); ?> <header class="archive-header wrapper"> <a class="button small" href="#" id="filter-toggle">Filter Styles</a> <h1 class="page-title search-title"> <?php if ($search_new || $gender || $filter || $collection || $style || $fit){ ?> Filter Results <?php if ($search_new!==''){ ?>For: <span><?php echo esc_html($wp_query->query['s']); ?></span> <?php } ?> <?php if($filter){ echo '<a href="'.$filter->slug.'">'.$filter.'</a>'; } ?> <?php if($gender){ if ($filter){echo '/ ';} echo $gender; } ?> <?php if($collection){ if ($filter || $gender ){echo '/ ';} echo $collection; } ?> <?php if($style){ if ($filter || $gender ||$collection ){echo '/ ';} echo $style; } ?> <?php if($fit){ if ($filter || $gender ||$collection || $style ){echo '/ ';} echo $fit; } ?> <?php } else{ echo 'All Bodystyles'; } ?> </h1> </header><!-- .page-header --> <?php /* Start the Loop */ ?> <?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. */ if ($_SERVER['HTTP_REFERER'] == 'http://goldengoods.staging.wpengine.com/design-lab/'){ get_template_part( 'content', 'productlab' ); } else { get_template_part( 'content', 'product' ); } ?> <?php endwhile; ?> <?php the_posts_navigation(); ?> <?php else : ?> <?php get_template_part( 'content', 'none' ); ?> <?php endif; ?> </main><!-- #main --> </div><!-- #primary --> <?php get_footer(); ?>
Trevor(Private) May 3, 2017 at 12:30 pm #106163Whilst not being sure it is the issue, but all the code you show seems to be looking foa standard WordPress search string, e.g.
$wp_query->query['s']
I say this because Search & Filter does not use the
s
string. Let us say that I had a shop on a site called mysite.com. The normal WordPress search for spider would be:https://mysite.com/shop/?s=spider
But in Search and filter it would be:
https://mysite.com/shop/?_sf_s=spider
Anonymous(Private) May 8, 2017 at 7:05 pm #107409but that doesnt have anything to do with the results showing or not showing, and the page functions fine when you include any letter or number in the search field. Can you guys please escalate this to a support thread so we can get it working? I need this to function for my site.
-
AuthorPosts