Created
July 26, 2016 16:11
-
-
Save ryanshoover/6164311008daae94854347a394b0e19f to your computer and use it in GitHub Desktop.
PHP to style WP Engine Admin Bar in staging
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
// Define the environment if we don't have one already | |
if ( ! defined( 'WPE_ENVIRONMENT' ) ) { | |
// Test to see if we're in staging | |
if ( isset( $_SERVER['IS_WPE_SNAPSHOT'] ) && $_SERVER['IS_WPE_SNAPSHOT'] ) { | |
define( 'WPE_ENVIRONMENT', 'staging' ); | |
} else { | |
define( 'WPE_ENVIRONMENT', 'production' ); | |
} | |
} | |
// Filter the body classes to add our environment | |
function wpe_filter_body_classes( $classes ) { | |
$classes[] = strtolower( WPE_ENVIRONMENT ); | |
return $classes; | |
} | |
add_filter( 'body_class', 'wpe_filter_body_classes' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment