- This topic has 1 reply, 2 voices, and was last updated 5 years, 6 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
These forums are now closed and remain for historical purposes.
None of the content applies to the new version 3. For support, get in touch via our contact form.
Forums › Forums › Search & Filter Pro › Conditional to check if request is search filter
I have a custom post type that uses a custom query to show items along side a Search & Filter Pro filter.
In my archive template I’d like to add a check to see if the request is coming from Search & Filter Pro.
Some thing liks:
if (search and filter pro query active) {
show WP loop
} else {
custom query
}
Thanks for your help!
Something like this would do I think (change the ID number to suit):
global $searchandfilter;
$sf_current_query = $searchandfilter->get(1234)->current_query();
if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
// show normal loop
} else {
// show loop when S&F active
}