Skip to content

Commit

Permalink
clean body classes, see #3
Browse files Browse the repository at this point in the history
  • Loading branch information
billerickson committed Jul 20, 2016
1 parent 00f7496 commit 0b0abb8
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion inc/wordpress-cleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,25 @@ function ea_clean_post_classes( $classes ) {

return array_intersect( $classes, $allowed_classes );
}
add_filter( 'post_class', 'ea_clean_post_classes' );
add_filter( 'post_class', 'ea_clean_post_classes' );

/**
* Clean Body Classes
*
*/
function ea_clean_body_classes( $classes ) {

if( ! is_array( $classes ) )
return $classes;

$allowed_classes = array(
'single',
'page',
'single-' . get_post_type(),
'admin-bar',
ea_page_layout()
);

return array_intersect( $classes, $allowed_classes );
}
add_filter( 'body_class', 'ea_clean_body_classes' );

0 comments on commit 0b0abb8

Please sign in to comment.