How can I display the selected search parameters in the results screen

Forums › Forums › Search & Filter Pro › How can I display the selected search parameters in the results screen

Viewing 6 posts – 1 through 6 (of 6 total)
  • Anonymous
    #124894

    How can I display the selected search parameters in the results screen?

    For example, if I have a state and city search fileds, and A user chose from the options list England and london, when the results are loaded I want to add a line:

    “Showing results for England, London”

    Is it possible?

    Thanks.

    Trevor
    #124896

    If you read through this thread, it is almost the same subject, and so the resources and links given will apply:

    https://support.searchandfilter.com/forums/topic/search-results-title-in-genesis-child-theme/

    Anonymous
    #124949

    Hi,

    I am trying to use this code in the results.php file:

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1274)->current_query();
    $searchTerm = $sf_current_query->get_search_term();
    echo $searchTerm;

    but I get no results

    Trevor
    #124971

    Is your search from a textual search field (where the use types a word or phrase to search for)? get_search_term() will not work for options chosen from dropdowns or other selection-based form fields.

    Anonymous
    #124975

    Hi Trevor,

    Thanks for the reply, I found the solution:

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1274)->current_query()->get_array();
    foreach($sf_current_query as $key) {
    	echo '<span>' . $key['value'] . ' ' . $key['name'] . ' ' . $key['active_terms'][0]['name'] . ', </span>'; 
    	}	
    Trevor
    #124977

    Great. I will close this thread for now.

Viewing 6 posts – 1 through 6 (of 6 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.