Skip to content

Instantly share code, notes, and snippets.

@bmdinteractive
Created November 20, 2017 19:30
Show Gist options
  • Save bmdinteractive/c3abbd6b0f381b41eead67fe391ac945 to your computer and use it in GitHub Desktop.
Save bmdinteractive/c3abbd6b0f381b41eead67fe391ac945 to your computer and use it in GitHub Desktop.
Adds the post type and page slug to body class
function add_type_slug_body_class( $classes ) {
global $post;
if ( isset( $post ) ) {
$classes[] = $post->post_type . '-' . $post->post_name;
}
return $classes;
}
add_filter( 'body_class', 'add_type_slug_body_class' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment