been hacking at this for some time and haven't been able to make much progress. The goal is to add a custom body class to a specific page. -I know there are a few answered posts on this topic, and while the solution provided works if I add the custom body class globally, it fails when I add the if statement. Any ideas of what might prevent this from registering the custom body class?
These Fail:
add_filter('body_class', 'custom_body_class');
function custom_body_class($classes) {
if (is_page('shop'))
$classes[] = 'services';
return $classes;
}
Or
add_filter('body_class', 'custom_body_class');
function custom_body_class($classes) {
if (is_page('4'))
$classes[] = 'services';
return $classes;
}
but this works, unfortunately globally:
add_filter('body_class', 'custom_body_class');
function custom_body_class($classes) {
// if (is_page('shop'))
$classes[] = 'services';
return $classes;
}
I am on Genesis Framework, WPEngine, have WooCommerce and all are up to date. -Weird.
is_shop()
as condition.