May 12, 2016 - No Comments!

How to add your own classes to body tag on WordPress

Developing a theme or a plugin for WordPress you may need to add some custom classes to the body tag.

Below you can find an example of a function that you can customize to add your classes to the body tag, feel free to edit it to gain your goals.

if(!function_exists('thmlv_body_classes')) {
function thmlv_body_classes($classes) {
// Add your own classes
$class = 'your_own_class';
// Assign your classes to the array
$classes[] = $class;
return $classes;
}
add_filter('body_class', 'thmlv_body_classes');
}

Related Post

Published by: Themelovin in Code
Tags: ,

Leave a Reply