Skip to content

Instantly share code, notes, and snippets.

@chriskoelle
Created December 5, 2013 20:17
Show Gist options
  • Save chriskoelle/7813116 to your computer and use it in GitHub Desktop.
Save chriskoelle/7813116 to your computer and use it in GitHub Desktop.
Wordpress Body Class Cleanup Removes some of the rerely used classes output by Wordpresses body_class function in order to cut down on markup
function cleanup_post_class( $classes, $class, $post_id ) {
foreach($classes as $key => $class):
if(preg_match('/(^tag)|(^post)|(hentry)|(uncategorized)|(status)/', $class)) unset($classes[$key]);
endforeach;
$classes[] = 'post-'.$post_id;
return $classes;
}
add_filter('post_class', 'cleanup_post_class', 10 , 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment