Created
August 3, 2012 11:12
-
-
Save ashfame/3246712 to your computer and use it in GitHub Desktop.
Add page 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 | |
function custom_body_class($classes){ | |
global $wp_query; | |
if ( is_page() ) { | |
$post_obj = $wp_query->get_queried_object(); | |
array_push($classes, 'slug-'.$post_obj->post_name); | |
} | |
return $classes; | |
} | |
add_filter('body_class', 'custom_body_class'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment