Search word is considered as "empty" when I enabled Relevanssi at advance menu.

Forums › Forums › Search & Filter Pro › Search word is considered as "empty" when I enabled Relevanssi at advance menu.

Tagged: 

Viewing 5 posts – 1 through 5 (of 5 total)
  • Anonymous
    #222265

    Hi Trevor

    I like to include custom meta in search result, so I installed Relevanssi, and enabled it at SF Pro advance menu.

    Then, my search result page start to say, “Empty search words” as I set it for no word search.

    Anonymous
    #222266
    This reply has been marked as private.
    Anonymous
    #222272

    Hi Trevor

    I could solve the problem by deleting the code “the_search_query.”

    Thank you.

    Trevor
    #222314

    That will be a function from your theme to see if a standard WordPress text search has been made, which indeed would be required to remove. Make sure you are using a child theme and name this file differently, and point our search to use this new file as the template.

    Our plugin, if you want to make a similar check if a search has been made, would use code like this:

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

    Where the IF condition is set to display a different message if no search has been made (you can obviously change what it says, including adding HTML etc). Laos, change the ID number 85204 to whatever ID number our form is.

    Trevor
    #222316
    This reply has been marked as private.
Viewing 5 posts – 1 through 5 (of 5 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.