Created
December 5, 2013 20:17
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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