2

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?

6

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.

4

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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