Forums Forums Search & Filter Pro No results message, but results shown below

Viewing 10 posts - 1 through 10 (of 19 total)
  • Anonymous
    #245637

    Hi Trevor and Ross,

    I hope you’re both doing ok :).

    Just a quick one that we’ve had raised by one of our client’s SEO people.

    Basically we have a search and filter form which has filter dropdowns, and we have it so that it only includes entries in the dropdowns for options that there are results for, great and working fine as always.

    What the SEO company have flagged though is a link to a filter search which is obviously referenced somewhere ie: ?_sft_expertise=directors BUT there is no entry for ‘directors’ in the dropdown (maybe there was before hence the existence of this link), and so what the page does is it shows the ‘no results’ message but then displays results beneath it, and they are flagging this as soft 404 issue.

    Now we do have the AJAX setting to say: ‘Changes the URL in the address bar as the user searches.’ and probably if this wasn’t the case maybe this wouldn’t even happen, but we need that I think because we call this results page from other pages in the site via querystring parameters to pre-filter the results depending on the page they came from.

    I hope all this makes sense and look forward to hearing from you in terms of any advice on addressing this etc. :).

    Many thanks,
    Tonya

    Anonymous
    #245638
    This reply has been marked as private.
    Trevor
    #245858

    Would you want the content on those paginated pages not indexed? It is possible to tell bots not to index pages with search and filter query strings on them. You could do this using the functions.php file of your child theme, maybe something like this:

    add_action('wp_head', 'noRobots');
    function noRobots() {
      if(strpos($_SERVER['REQUEST_URI'], '?_sf_s') !== false) {
        echo "\t<meta name='robots' content='noindex, nofollow' />\r\n";
      }
    }
    Anonymous
    #245939

    Hi Trevor,

    Thanks ever so much for this, so two quick points on this, we could add that, but the Yoast plugin also outputs the standard follow tags on the page too, so would this pose an issue having one noindex tag and then another with index?

    Also, as there are no results for these non-existent terms in the current taxonomy drop-downs, so would it be possible to stop the results from showing beneath, when there are no results, as I also wasn’t sure why that was happening and does cause a little confusion regardless? Please let me know what you think 🙂

    Many thanks,
    Tonya

    Trevor
    #246188

    To the first question, I do not know. You would need to try it and see what is output on the page and see if you do have both sets. If they ARE both there, I suspect that the page will not be indexed. But you may need to ask them that question. They may have a better way of doing it.

    I am not sure what can be done about the situation where the search has no results, but you say post show anyway? But, if the noindex thing works, is this an issue? Or are the terms still in the dropdowns, in which case …

    In the General settings tab of the form:

    Set Auto Count (both settings) to ON

    And then in the Form UI:

    In each field set Hide Empty to ON

    Anonymous
    #246230
    This reply has been marked as private.
    Trevor
    #246248

    That issue is simply the way that whatever code outputs the posts handles a ‘No Results Found’ scenario. As you are using our Shortcode method, and thus the infinite scroll version of results.php, this customized version handles ‘No Results’ better I think:

    <?php
    /**
     * Search & Filter Pro 
     *
     * Sample Results Template
     * 
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      http://www.designsandcode.com/
     * @copyright 2015 Designs & Code
     * 
     * Note: these templates are not full page templates, rather 
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode - think 
     * of it as a template part
     * 
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs 
     * and using template tags - 
     * 
     * http://codex.wordpress.org/Template_Tags
     *
     */
    
    if ( $query->have_posts() ) {
     ?>
     
     Found <?php echo $query->found_posts; ?> Results<br />
     <div class='search-filter-results-list'>
     <?php
      while ($query->have_posts())
      {
       $query->the_post();
       
       ?>
       <div class='search-filter-result-item'>
        <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
        
        <p><br /><?php the_excerpt(); ?></p>
        <?php 
         if ( has_post_thumbnail() ) {
          echo '<p>';
          the_post_thumbnail("small");
          echo '</p>';
         }
        ?>
        <p><?php the_category(); ?></p>
        <p><?php the_tags(); ?></p>
        <p><small><?php the_date(); ?></small></p>
        
        <hr />
       </div>
       
       <?php
      }
     ?>
     </div>
    <?php
    } else {
     
     //figure out which type of "no results" message to show
     $message = "noresults"; 
     if(isset($query->query['paged'])) {  
      if($query->query['paged']>1){
       $message = "endofresults";
      }
     }
     
        if($message=="noresults") {
        ?>
     <div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
      <span>No Results Found</span>
     </div>
     <?php
        } else {
     ?>
     <div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
      <span>End of Results</span>
     </div>
     <?php
     }
    }
    ?>

    Try using that instead?

    Anonymous
    #246355
    This reply has been marked as private.
    Trevor
    #246483
    This reply has been marked as private.
    Anonymous
    #246710
    This reply has been marked as private.
Viewing 10 posts - 1 through 10 (of 19 total)