Published on Feb 8, 2022
How To Add a Body Class to All Pages That Use a Specific Oxygen Template
Sridhar Katakam
If you are looking to add a custom class to the list of existing classes for the opening body tag to all pages that uses an Oxygen Template, simply add the following code in a Code Block in the Template:
<?php
add_filter( 'body_class', function( $classes ) {
return array_merge( $classes, array( 'marketing-page' ) );
} );
?>
Replace marketing-page
with your desired class name.
![](https://wpdevdesign.com/wp-content/uploads/2022/02/body-class-oxygen-template-1024x213.png)
It should not matter where the Code Block is in the Template. But for simplicity’s sake and being able to locate quickly you might want to place it as the top-most element in the structure.
Reference
https://developer.wordpress.org/reference/hooks/body_class/#comment-1681