Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Search not returning any results anymore.

Viewing 10 posts - 1 through 10 (of 14 total)
  • Jessie Matanky
    #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 🙂

    http://goldengoodsusa.com/our-bodystyles/

    Jessie Matanky
    #105996

    also 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');
    Jessie Matanky
    #106003

    I had to remove the code on our main site because we cant have it displaying no results for people. I kept the search form on our staging site, so here is a new link:

    http://goldengoods.staging.wpengine.com/our-bodystyles/#

    Trevor Moderator
    #106021

    What template does the saerch results page use? If it is search.php, are you able to copy and paste that here, in code ticks as you did above?

    Jessie Matanky
    #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>&nbsp;
    				<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 Moderator
    #106163

    Whilst 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

    Jessie Matanky
    #107409

    but 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.

    Jessie Matanky
    #107411

    the code that looks for $wp_query->query[‘s’] is only used to display the terms in a breadcrumb. It has nothing to do with the rest of the page that should be displaying the search results.

    Jessie Matanky
    #107417

    I also tried to do this using a default twenty seventeen theme and the same thing is happening. So it is not my theme.

    Trevor Moderator
    #107442
    This reply has been marked as private.
Viewing 10 posts - 1 through 10 (of 14 total)

The topic ‘Search not returning any results anymore.’ is closed to new replies.