Forums Forums Search & Filter Pro Conditional to check if request is search filter

Viewing 2 posts - 1 through 2 (of 2 total)
  • Anonymous
    #251245

    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!

    Trevor
    #251257

    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
    }
Viewing 2 posts - 1 through 2 (of 2 total)