Posted By

joelhaus on 11/16/09


css php wordpress filter thesis thesiswp classfunction

Versions (?)

Who likes this?

4 people have marked this snippet as a favorite


Enable WordPress body class function in Thesis Theme

 / Published in: PHP


In v1.6, the Thesis Theme has a bug which removes a necessary space in the HTML body tag if you add a filter targeting the thesisbodyclasses hook. To get the native WP body_class function to work, use this code:

  1. function my_body_class( $class = '' ) {
  2. // Separates classes with a single space, collates classes for body element
  3. echo ' class="' . join( ' ', get_body_class( $class ) ) . '"';
  4. }
  6. add_filter('thesis_body_classes','my_body_class');

Report this snippet  


RSS Icon Subscribe to comments
Posted By: mehigh on September 24, 2010

To get the native WP body_class function in Thesis v1.7, use the following code: It gets the bodyclass array, and adds it to the $classes array the classes one by one. There might be other 'more efficient' solutions out there, but it works :)

`function my_body_class( $classes ) {
$bodyclasses = get_body_class();
foreach ($bodyclasses as $bodyclass) {
    $classes[] .= $bodyclass;
return $classes;    
Posted By: mehigh on September 24, 2010

Note - the above works on v1.8.

You need to login to post a comment.