WordPress Custom Body classes
WordPress Custom Body classes are something any WordPress developer will need to deal with sooner or later.
Using a plugin for this would be overkill because in most cases all we need are a couple of lines of code.
So, how do we add WordPress Custom Body classes?
WordPress has both a body_class function and a body_class filter (hook).
The body_class function is used in themes to add the classes autogenerated by WordPress, to the body tag of your website.
This is how it is added to the header.php file of your theme:
World of WordPress is hosted by:
With Rocket, your websites will be blazing fast, always protected, and supported 24/7 by our experts with over 17 years of experience.