Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Title: Add the slug inside the WordPress page main body tag class
- // Description: This function will include the slug
- // of every page created inside the class section of the body class.
- function slug_body_class_for_pages( $classes ) {
- if ( is_singular( 'page' ) ) {
- global $post;
- $classes[] = 'page-' . $post->post_name;
- }
- return $classes;
- }
- add_filter( 'body_class', 'slug_body_class_for_pages' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement