Best Way To Add Body Class In WP

Share Now

1.Add classes in Body with array

<?php body_class(array("first_class","second_class","third_class"));?>

2. Remove by default generated class from body. Add Filter in function.php file

function themename_body_class($classes){
unset($classes[array_search("add_class_name_you_want_to_remove",$classes)]);
return $classes;
}
add_filter("body_class","themename_body_class");
Picture of Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert