I always forget how to add classes to the body tag in WordPress. You can use this code for generating any kind of class. Just replace the foreach statement with the variable you want to pull from the page.

function add_category_to_single($classes) {
if (is_single() ) {
global $post;
foreach((get_the_category($post->ID)) as $category) {
// add category slug to the $classes array
$classes[] = $category->category_nicename;
// return the $classes array
return $classes;

After you have typed in some text, hit ENTER to start searching...