Skip to content

Instantly share code, notes, and snippets.

@deadlyhifi
Created September 3, 2015 07:00
Show Gist options
  • Save deadlyhifi/8571e61b6ae689655882 to your computer and use it in GitHub Desktop.
Save deadlyhifi/8571e61b6ae689655882 to your computer and use it in GitHub Desktop.
WP: Add page class to body
function body_class_adder($classes)
{
global $post;
if (isset($post)) {
$classes[] = $post->post_type . '-' . $post->post_name;
}
return $classes;
}
add_filter('body_class', 'body_class_adder');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment