Forums Forums Search & Filter Pro results page not loading properly

Tagged: 

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

    Hi,

    Love the plugin, but I’m have one tiny issue. I couldn’t seem to find it in the forum, but if it’s already posted, please let me know.

    I’ve set the results display page template to the template that handles all of my other archive pages page-archive.php, however, the results page doesn’t load properly.

    Sample of working archive page: http://leisuregrouptravel.com/site-inspections/
    Sample of misformed results page: http://leisuregrouptravel.com/itinerary/?_sft_category=food-drink

    I believe the issue has to do with a function called body_class that runs on every pageload. For some reason that body_class thinks you are on the home page as well as forcing it to be an archive. Using the page load in Inspector, it seems like removing “body” solves the issue.

    For example right now it’s: home blog archive custom-background chrome et_includes_sidebar

    But should look something like: archive category category-site-inspections category-3 custom-background chrome et_includes_sidebar

    I’m not sure how to fix this issue. Any help would be appreciated.

    Many thanks

    Trevor
    #69585

    You would most likely need to use a function in your theme (child theme I hope, otherwise make your theme into a child theme – much safer) functions.php file.

    You need the ID number of the search form as well and the class name you want to remove. So, here is some sample code:

    global $searchandfilter;
    add_filter( 'body_class','remove_my_body_classes' );
    function remove_my_body_classes( $classes ) {
      if ( $searchandfilter->active_sfid() == 35889) {
        if(($key = array_search('class_name_here', $classes)) !== false) {
          unset($classes[$key]);
    				}
        return $classes;
      }
    }

    Replace the number 35889 with your search form ID number (from the shortcode) and replace the phrase body_class with whatever you need to remove.

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