Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

2 Answers 2

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
1  
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:

body_class('two-sidebars')

http://codex.wordpress.org/Function_Reference/body_class

share|improve this answer

Your Answer

 
discard

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.