Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('body_class', 'alc_remove_body_class', 20, 2);
- function alc_remove_body_class($wp_classes, $extra_classes) {
- if( is_page_template('template-file-name.php') ) :
- // List of the classes to remove from the WP generated classes
- $remove = array('singular'); //allows for multiple classes to be removed
- // Filter the body classes
- foreach( $remove as $val ) {
- if (!in_array($val, $wp_classes)) : continue;
- else:
- foreach($wp_classes as $key => $value) {
- if ($value == $val) unset($wp_classes[$key]);
- }
- endif;
- }
- endif; // Add the extra classes back untouched
- return array_merge($wp_classes, (array) $extra_classes);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement