Created
March 27, 2018 09:13
-
-
Save keithdevon/b76730f7b48714a924ee9a482b2ed3e6 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 | |
/** | |
* This function appends a class to the body depending on the environment. | |
* | |
* @param array $classes current body classes. | |
* | |
* @return array $classes any modification to the class array. | |
*/ | |
function tgf_add_environment_class( $classes ) { | |
if ( WP_LOCAL ) { | |
$classes[] = 'env--local'; | |
} | |
if ( WP_STAGING ) { | |
$classes[] = 'env--staging'; | |
} | |
if ( WP_PRODUCTION ) { | |
$classes[] = 'env--production'; | |
} | |
return $classes; | |
} | |
add_filter( 'body_class', 'tgf_add_environment_class' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment