In some cases I need to programmatically remove the sidebar_first region in template.php. So, I'm doing something like:
function template_preprocess_page(&$variables) {
if(my_condition){
unset($variables['page']['sidebar_first']);
}
}
this does, indeed, remove the sidebar, however, it does NOT alter the body classes. So, I still have a class of
body.two-sidebars
...even though I unset one of them (so the proper class would be body.one-sidebar).
How can I programmatically remove a sidebar AND have it alter the body classes properly?
(please, for various reasons dont suggest creating a new template suggestion and altering the sidebar there. that won't work in my case. I am asking specifically how to remove a region programmatically)