Created
September 11, 2014 00:24
-
-
Save joshuadavidnelson/0a5b59be430b5ba76914 to your computer and use it in GitHub Desktop.
Add page/post slug to the body class in WordPress
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 | |
/** | |
* Add the post/page slug to the body class | |
*/ | |
add_filter( 'body_class', 'jdn_slug_body_class' ); | |
function jdn_slug_body_class( $classes ) { | |
global $post; | |
$classes[] = $post->post_name; | |
return $classes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment