Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
add_filter( 'body_class', 'knx_body_class_for_pages' );
* Adds a css class to the body element
* @param array $classes the current body classes
* @return array $classes modified classes
function knx_body_class_for_pages( $classes ) {
global $post;
$classes[] = $post->post_name;
return $classes;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment