Skip to content

Instantly share code, notes, and snippets.

@onishiweb
Created February 22, 2014 10:55
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 onishiweb/9151982 to your computer and use it in GitHub Desktop.
Save onishiweb/9151982 to your computer and use it in GitHub Desktop.
/**
* Include useful classes in body_class and post_class
*/
function dig_add_useful_classes($classes) {
global $post;
if( ! is_tag() ) {
$classes[] = dig_get_post_type_class();
}
if( is_page() ) {
global $post;
$classes[] = 'page-' . $post->post_name;
}
return $classes;
}
add_filter('post_class', 'dig_add_useful_classes');
add_filter('body_class', 'dig_add_useful_classes');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment