# Add Classes to Bricks' Body Class Using Dynamic Data

**URL:** <https://forum.bricksbuilder.io/t/add-classes-to-bricks-body-class-using-dynamic-data/6972>\
**Category:** Feature Requests / Improvements\
**Created:** [October 14, 2022, 5:33pm UTC](https://forum.bricksbuilder.io/t/add-classes-to-bricks-body-class-using-dynamic-data/6972 "2022-10-14T17:33:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![digitalgravy](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/digitalgravy/32/2464_2.png) [@digitalgravy](https://forum.bricksbuilder.io/u/digitalgravy)\
**Post date:** [October 14, 2022, 5:33pm UTC](https://forum.bricksbuilder.io/t/add-classes-to-bricks-body-class-using-dynamic-data/6972/1 "2022-10-14T17:33:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mizzinc](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/mizzinc/32/4398_2.png) [@mizzinc](https://forum.bricksbuilder.io/u/mizzinc)\
**Post date:** [October 18, 2022, 12:02am UTC](https://forum.bricksbuilder.io/t/add-classes-to-bricks-body-class-using-dynamic-data/6972/2 "2022-10-18T00:02:09Z")

</div>

C’mon amigo, keep ya hands dirty 🙂

---

<div class="post-metadata">

**Author:** ![Wario](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/wario/32/286_2.png) [@Wario](https://forum.bricksbuilder.io/u/Wario)\
**Post date:** [October 18, 2022, 7:41am UTC](https://forum.bricksbuilder.io/t/add-classes-to-bricks-body-class-using-dynamic-data/6972/3 "2022-10-18T07:41:49Z")

</div>

i did that with some custom code:

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

```

---

<div class="post-metadata">

**Author:** ![mredodos](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/mredodos/32/4345_2.png) [@mredodos](https://forum.bricksbuilder.io/u/mredodos)\
**Post date:** [December 14, 2022, 12:27pm UTC](https://forum.bricksbuilder.io/t/add-classes-to-bricks-body-class-using-dynamic-data/6972/4 "2022-12-14T12:27:21Z")

</div>

we need it up +1

check it [Add Dynamic Body CSS Class Control - Bricks Builder Page Settings Customization - Pure Coding Knowledge Sharing Blog](https://itchycode.com/add-dynamic-body-css-class-control-bricks-builder-page-settings-customization/)

---

<div class="post-metadata">

**Author:** ![muhammad.saddar](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/m/53a042/32.png) [@muhammad.saddar](https://forum.bricksbuilder.io/u/muhammad.saddar)\
**Post date:** [July 29, 2025, 6:35am UTC](https://forum.bricksbuilder.io/t/add-classes-to-bricks-body-class-using-dynamic-data/6972/5 "2025-07-29T06:35:06Z")

</div>

It’s a much need feature

---

<div class="post-metadata">

**Author:** ![cypher](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/cypher/32/6160_2.png) [@cypher](https://forum.bricksbuilder.io/u/cypher)\
**Post date:** [August 14, 2025, 2:49pm UTC](https://forum.bricksbuilder.io/t/add-classes-to-bricks-body-class-using-dynamic-data/6972/6 "2025-08-14T14:49:45Z")

</div>

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?
