WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to add a class of "two-sidebars" to the regular bunch of WP classes that are generated by <?php body_class(); ?>>

The reason I need to do this is I'm integrating WP into a Drupal install, and need to keep the "two-sidebars" class for style reasons for the Drupal part of the page.

What's the best way? jQuery? Is it possible to hook into body_class?

share|improve this question
up vote 6 down vote accepted

You can add to the function simply by placing the desired class as the first parameter like so body_class('class-name').

If you'd like a little more flexibility you can hook into it using add_filter('body_class','my_class_names').

You can read more here.

share|improve this answer
Here's a working example of using a filter. – Chip Bennett Aug 11 '11 at 19:44

you can add extra classes directly into the function, as arguments; for permanently, use:



share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.