/ Published in: PHP

URL: http://codesnippets.joyent.com/posts/show/2304
Function to add custom body class in th Thesis theme for WordPress...Thanks to @girliegeek!
Expand |
Embed | Plain Text
// 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');
Comments

You need to login to post a comment.
An even better method using WP's native bodyclass: (via: http://diythemes.com/forums/bug-reports/17306-thesis-breaks-wp-bodyclass-function.html)
function mybodyclass( $class = '' ) { // Separates classes with a single space, collates classes for body element echo ' class="' . join( ' ', getbodyclass( $class ) ) . '"'; }
addfilter('thesisbodyclasses','mybody_class');