Created
September 3, 2015 07:00
-
-
Save deadlyhifi/8571e61b6ae689655882 to your computer and use it in GitHub Desktop.
WP: Add page class to body
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
function body_class_adder($classes) | |
{ | |
global $post; | |
if (isset($post)) { | |
$classes[] = $post->post_type . '-' . $post->post_name; | |
} | |
return $classes; | |
} | |
add_filter('body_class', 'body_class_adder'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment