Add Classes to Bricks' Body Class Using Dynamic Data

Would be very powerful if we could add classes to the <body> using dynamic data. This would allow us to add classes to the body on a per-page or per-post basis from custom fields and then manipulate the page styling based on these body classes.

I know this is possible with custom code, but having it built into Bricks would be a huge benefit.

75 Likes

C’mon amigo, keep ya hands dirty :slight_smile:

i did that with some custom code:

function add_acf_body_class($class) {
    $value = get_field('color');
    $class[] = $value;
    return $class;
}
add_filter('body_class', 'add_acf_body_class');
6 Likes

we need it up +1

check it Add Dynamic Body CSS Class Control - Bricks Builder Page Settings Customization - Pure Coding Knowledge Sharing Blog

2 Likes

It’s a much need feature

Isn’t this already possible? I add a text field to a CPT with MB Pro that says ‘classname’, input whatever classes I want, go to the template, select Page Settings, click the dynamic data icon under CSS classes (body) and select the MB field, save, and go to town. You can even put a string of classes (leave off the periods) and all will be applied. What am I missing?