Forums Forums Search & Filter Pro How te remove initial results when using results shortcode

Viewing 6 posts - 1 through 6 (of 6 total)
  • Anonymous
    #176258

    I build a page whit the search form and results shortcode in it. But when you browse to the page, there are already search results on the page. Can this be removed?

    Anonymous
    #176259
    This reply has been marked as private.
    Trevor
    #176320

    This would depend on the layout template being used for your page. That would depend on your theme or page builder/content plugin that you are using, or, if you are using our shortcode display results method and our results.php template file, it would look like this:

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1024)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
      echo '<div>Nothing to see here folks!</div>'; 
    } else {
      // your template archive code/loop OR results.php code here
    }

    Change 1024 to the ID number of your form (from the form shortcode).

    Anonymous
    #188469

    Hi, thanks for the trick. Can I get a similar effect when clicking on the reset button?

    Trevor
    #188470

    I am not sure. You might want to put a fake reset button that simply links back to the base page URL.

    Anonymous
    #188527

    Ok, I see. Thank you Trevor.

Viewing 6 posts - 1 through 6 (of 6 total)