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)