Limit search results before filtering

Forums › Forums › Search & Filter Pro › Limit search results before filtering

Viewing 9 posts – 1 through 9 (of 9 total)
  • Anonymous
    #190343

    Hello,

    I’d like to limit what’s visible before and after filtering. Is there a way to set a class for before and after filtering? Or is there something in place already?

    I don’t want all results to be invisible before filtering, only some (those with a certain class that I’ve set).

    Thanks.

    Trevor
    #190348

    What Display Results method are you using? What is the class that you have set, and are you able to send me a live link/URL to your search page so I can take a look?

    Anonymous
    #190350
    This reply has been marked as private.
    Trevor
    #190382
    This reply has been marked as private.
    Anonymous
    #190384
    This reply has been marked as private.
    Trevor
    #190388
    This reply has been marked as private.
    Anonymous
    #190402
    This reply has been marked as private.
    Trevor
    #190444
    This reply has been marked as private.
    Anonymous
    #190495

    Perfect, that works. Thank you very much!

    For others, the answer was to add the following lines in the results.php, which adds a “not-sf-filtered” or “sf-filtered” class:

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1075)->current_query();
    if (!$sf_current_query->is_filtered()) {
      $is_filtered = " not-sf-filtered";
    } else {
      $is_filtered = " sf-filtered";
    } ?>
    
    <div class="content-width<?php echo $is_filtered;?>">
Viewing 9 posts – 1 through 9 (of 9 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.