.media class added to body element causing styling issues


#1

The class "media" seems to be added to the body element. I have seen this causes problems for some people using Twitter Bootstrap. The workaround is to override the bootstrap styles in your theme's style.css. Aside from the Bootstrap conflicts this class seems to be causing conflicts elsewhere for me and I can't pin down the problem.

Is it possible to stop 'media' being added to the body element or perhaps change the class name slightly to "multimedia" so it doesn't interfere with existing styles?

Thanks


#2

BuddyPress adding that classes in body tag because media is a component in buddypress.

you can remove using body_class filter.

add_filter ( 'body_class', 'rt_bp_get_the_body_class', 11, 2 );  
function rt_bp_get_the_body_class($wp_classes, $custom_classes = false){  
    $wp_classes = array_replace ( $wp_classes, array_fill_keys (  
            array_keys ( $wp_classes, 'media' ), 'multimedia'  
        )  
    );  
    return $wp_classes;  
}  

#3

@faishalsaiyed thanks for the code! This solves the problem for me. Anybody using Bootstrap (I think about 1% of the web these days) will love this filter! :)


#4

#5

#6