classes // $classes = array of classes WP is already planning to add function USBC_add_body_class( $classes ) { // get the global post variable global $post; // make sure we're on a post page if ($post && $post->ID) : // loop through any categories foreach( get_the_category($post->ID) as $category ) { // and push the trimmed version to the $classes array $classes[] = trim( $category->category_nicename ); } // get the current page's URI (the part _after_ your domain name) $uri = $_SERVER["REQUEST_URI"]; // explode that string into an array of "pieces" $bodyclass = explode('/',$uri); // loop through those pieces and push each into the $classes array foreach($bodyclass as $category) { $classes[] = trim($category); } endif; // $post... // return a unique-onlye version of the array to WP return array_unique($classes); } add_filter('post_class', 'USBC_add_body_class'); add_filter('body_class', 'USBC_add_body_class'); endif; // !is_admin... ?>