Super handy WordPress filter that adds your page names as a CSS class to the WordPress body_class function. Add the following to functions.php….filter-licious.
<?php
add_filter('body_class','page_class');
function page_class($classes) {
global $wp_query;
$page = '';
$page = $wp_query->query_vars['pagename'];
// add 'pagename' to the $classes array
$classes[] = $page;
// return the $classes array
return $classes;
}
?>