Skip to content

Instantly share code, notes, and snippets.

@jmsmrgn
Created August 21, 2015 18:37
Show Gist options
  • Save jmsmrgn/4373d08b4e01def954df to your computer and use it in GitHub Desktop.
Save jmsmrgn/4373d08b4e01def954df to your computer and use it in GitHub Desktop.
WP - Add page slug to body class
/**
* Add page slug to body class
*/
function add_slug_body_class($classes) {
global $post;
if (isset($post)) {
$classes[] = $post->post_type . '-' . $post->post_name;
}
return $classes;
}
add_filter( 'body_class', 'add_slug_body_class' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment