DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Add Custom Body Class

02.26.2010
| 2135 views |
  • submit to reddit
        // description of your code here

// Add my-custom-class to body tag

function custom_body_class($classes) {
	$classes[] = 'my-custom-class';
	return $classes;
}
add_filter('thesis_body_classes', 'custom_body_class');

// To single pages only

function custom_body_class($classes) {
 if (is_single()) {
	$classes[] = 'my-custom-class';
	return $classes;
 }
}
add_filter('thesis_body_classes', 'custom_body_class');