I'm trying to edit classes in the body tag for custom post types so I can display the pages full width using the WooThemes Canvas built in full width class - instead of overriding it.
By default it seems the body class is set to 'two-col-right' and 'two-col-right-1080' for custom post types, I need them to be 'one-col' and 'one-col-1080'
Simple you would think, but it seems there is no way to edit a class, only a way to filter it out and add a new one?
It does add the 2 classes now but the old ones are not filtered out. can anyone see any issues with my code or is there an easier way to do this? thanks
this WordPress Answers post is very similar
The code so far is:
//*** make Services full col ***/
add_filter( 'body_class', 'custom_post_full_width', 'very late please', 2 );
function custom_post_full_width( $wp_classes, $extra_classes ) {
if ( is_archive('services') OR is_singular('services') ) {
// List of the only WP generated classes that are not allowed
$blacklist = array('two-col-right', 'two-col-right-1080');
// Blacklist result
$wp_classes = array_diff( $wp_classes, $blacklist );
// Extra classes to add
$extra_classes = array('one-col','one-col-1080');
}
// Add the extra classes back untouched
return array_merge( $wp_classes, (array) $extra_classes );
}
Not working though :(
i'm using funcions.php with a child theme of Canvas