Skip to content

Instantly share code, notes, and snippets.

@maycomayco
Created January 12, 2018 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maycomayco/373b263bd87f8d792b2455e5ef893ec8 to your computer and use it in GitHub Desktop.
Save maycomayco/373b263bd87f8d792b2455e5ef893ec8 to your computer and use it in GitHub Desktop.
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