12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
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:


add_filter( 'body_class', function( $classes ) {
	return array_merge( $classes, array( 'marketing-page' ) );
} );


Replace marketing-page with your desired class name.

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.