Forums › Forums › Search & Filter Pro › Showing the search query
- This topic has 6 replies, 2 voices, and was last updated 8 years, 4 months ago by
Anonymous.
-
Trevor(Private) February 22, 2017 at 9:17 pm #92106
You need instead to use code like this to get the query:
global $searchandfilter; $sf_current_query = $searchandfilter->get(339)->current_query();
Where 339 is the form ID.
You might need to dump the array to get an idea what is in it, but a search of the forum reveals some code snippets:
https://support.searchandfilter.com/forums/search/sf_current_query+searchandfilter+current_query/
I think it is possible that the next major release (V3, which we are working on right now) will have a much better way of doing this).
Anonymous(Private) February 22, 2017 at 11:08 pm #92142OK thats I got it.
For anyone else who stumbles across this here’s the full code to output the Search Query
Firstly this gets the Query (change number to your search form ID) – place in the loop in your template:
global $searchandfilter; $sf_current_query = $searchandfilter->get(54)->current_query(); $searchTerm = $sf_current_query->get_search_term();
and then you can echo out the query in your anywhere in your template
<?php echo $sf_current_query; ?>
-
AuthorPosts