- This topic has 3 replies, 2 voices, and was last updated 10 years, 7 months ago by .
Viewing 4 posts – 1 through 4 (of 4 total)
Viewing 4 posts – 1 through 4 (of 4 total)
Posted
by
Forums › Forums › Search & Filter Pro › New Error: Fatal Error
Hey Ross, now I am getting this error intermittently on various category pages:
Fatal error: Call to a member function active_sfid() on a non-object in /home/doglov7/public_html/wp-content/themes/canvas/functions.php on line 106
When using this code:
add_filter(‘body_class’,’add_body_class_to_search_filter’);
function add_body_class_to_search_filter($classes) {
global $searchandfilter;
if($searchandfilter->active_sfid())
{
$classes[] = “tax-product_cat archive woocommerce woocommerce-page alt-style-default
boxed-layout two-col-right width-930 two-col-right-930”;
}
// return the $classes array
return $classes;
}
Line 106 is:
if($searchandfilter->active_sfid())
Thanks!
Hi John
If the global $searchandfilter does not exist, it means that either Search & Filter is disabled, or something is trying to access it before the action plugins_ready is fired.
This could be a symptom of another issue, but a quick workaround could be to check if its set first.
After:
global $searchandfilter;
Add
if(!isset($searchandfilter))
{
return $classes;
}
Thanks