Last active
October 2, 2017 11:15
-
-
Save richtabor/bffade63c4737ad0cc339fca63b0bc80 to your computer and use it in GitHub Desktop.
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
<?php | |
/** | |
* Adds custom classes to the array of body classes. | |
* | |
* @param array $classes Classes for the body element. | |
* @return array | |
*/ | |
function prefix_body_classes( $classes ) { | |
// Add class to the body if the sidebar has widgets. | |
if ( is_active_sidebar( 'sidebar-1' ) && ! is_page() ) { | |
$classes[] = 'has-sidebar'; | |
} | |
return $classes; | |
} | |
add_filter( 'body_class', 'prefix_body_classes' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment