Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created October 29, 2011 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save billerickson/1325264 to your computer and use it in GitHub Desktop.
Save billerickson/1325264 to your computer and use it in GitHub Desktop.
Custom Body Classes
<?php
/**
* Custom Body Classes
* @link http://www.billerickson.net/wordpress-class-body-tag/
* @author Bill Erickson
*
* @param array $classes existing body classes
* @return array modified body classes
*/
function my_body_classes( $classes ) {
if ( is_home() )
$classes[] = "home";
if ( is_category() )
$classes[] = "category";
return $classes;
}
add_filter( 'body_class', 'my_body_classes' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment