Archived topic
One Container for Blog Section and Single Posts Only
1 reply · Started by Thomas on January 14, 2018
I run a website with multiple custom post types. The default setting is set to separate containers. I would like to have the blog section and single post type to have only one container.
I lifted the code below from another post but it's only partially working. I seem to be missing something.
add_filter( 'body_class', 'ivan_body_class', 100, 2 );
function ivan_body_class( $wp_classes, $extra_classes )
{
$wp_classes[] = 'one-container';
if ( is_front_page() || is_single() ) {
$wp_classes = array_diff( $wp_classes, array( 'one-container' ) );
} else {
$wp_classes = array_diff( $wp_classes, array( 'separate-containers' ) );
}
// Add the extra classes back untouched
return array_merge( $wp_classes, (array) $extra_classes );
}
Hi there,
This way would actually be better: https://generatepress.com/forums/topic/container-style-only-in-blog/#post-300748
Let me know if you need help with the full code :)