Forums › Forums › Search & Filter Pro › Search result is always interpreted as is_front_page, is_home
- This topic has 13 replies, 2 voices, and was last updated 6 years, 10 months ago by
Trevor.
-
Trevor(Private) October 12, 2018 at 4:44 pm #190892
It is your theme that is doing this. I also notice that you do not seem to have an archive.php template.
The search.php is calling the WordPress body_class() function. Using your functions.php, you can hook in to this and remove the blog and home classes. You can use force is_search to add the search body class.
As there is no ‘real’ page called ‘filter’, your code would then look to see if the page being loaded has the search body class, and if so, remove the blog and home classes:
add_action( 'body_class', 'my_custom_search_class'); function my_custom_search_class( $classes ) { // Remove 'blog' class if ((in_array('blog', $classes)) && (in_array('search', $classes))) { unset( $classes[array_search('blog', $classes)] ); } // Remove 'home' class if ((in_array('home', $classes)) && (in_array('search', $classes))) { unset( $classes[array_search('home', $classes)] ); } return $classes; }
As long as that runs after our plugin adds the search class, all should work, otherwise it might need a low priority set.
-
AuthorPosts