Last active
December 20, 2015 18:09
-
-
Save michaelcarwile/6173805 to your computer and use it in GitHub Desktop.
Add WordPress slug to body class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// don't copy php tag | |
//* Slug as body class | |
function body_class_slug( $classes ) { | |
global $post; | |
if ( isset( $post ) ) { | |
$classes[] = $post->post_name; | |
} | |
return $classes; | |
} | |
add_filter( 'body_class', 'body_class_slug'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment