Forums › Forums › Search & Filter Pro › results page not loading properly
Tagged: Results page
- This topic has 1 reply, 2 voices, and was last updated 8 years ago by Trevor.
-
Anonymous(Private) November 9, 2016 at 5:04 pm #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-drinkI 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(Private) November 10, 2016 at 11:53 am #69585You 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. -
AuthorPosts