Created
June 29, 2014 15:10
-
-
Save aderaaij/098b41c46ce27979deeb to your computer and use it in GitHub Desktop.
add page slug to body class: http://www.wpbeginner.com/wp-themes/how-to-add-page-slug-in-body-class-of-your-wordpress-themes/
This file contains hidden or 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 | |
// Page Slug 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