Skip to content

Instantly share code, notes, and snippets.

@ryanshoover
Created July 26, 2016 16:11
Show Gist options
  • Save ryanshoover/6164311008daae94854347a394b0e19f to your computer and use it in GitHub Desktop.
Save ryanshoover/6164311008daae94854347a394b0e19f to your computer and use it in GitHub Desktop.
PHP to style WP Engine Admin Bar in staging
// 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