# BODY CLASS ADD ONS add_filter('body_class', 'extra_body_class'); function extra_body_class($classes) { global $wp_query; // Add current slug on body class $current_id = $wp_query->post->ID; $post = get_post($current_id); $slug = $post->post_name; $classes[] = 'body-'.$slug; $classes[] = sanitize_html_class( str_replace( '.', '-', get_page_template_slug( $current_id ) ) ); return $classes; }
Leave a Reply