Forums Forums Search & Filter Pro Alter Template After Filter Fires

Viewing 4 posts - 1 through 4 (of 4 total)
  • Anonymous
    #255214

    Hello,

    I am looking to change my search form from using a custom search.php file to use the Custom results method and fire on the same page where the form exists. This works great for me in other instances but for this form, The sidebar where the results would show before using the form has specific content in it. I need to replace the content in that sidebar once someone hits one of the filters. Is there an if statement I can run in my template to change the code for the content that appears in this location once a filter is executed.

    URL: https://domain.com/advanced-search/
    After a filter is clicked: http://domain.com/advanced-search/?_sfm_types_of_partnerships=

    I have about 30+ filters but wasn’t sure if there is something I can use to swap out the default content and show the query template file id like once they use it.

    Thanks!

    Trevor
    #255240

    The PHP to use to conditionally run code looks like this (change the ID of the form to suit):

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1234)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
      // the current (unfiltered) posts output code here
    } else {
      // the desired (filtered) posts output code here
    }
    Anonymous
    #255314

    Perfect, thank you!

    Trevor
    #255316

    Thanks for getting back to me. I will close this thread for now.

Viewing 4 posts - 1 through 4 (of 4 total)