Skip to content

Instantly share code, notes, and snippets.

@pattonwebz
Last active October 9, 2017 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pattonwebz/b7f0a4f29530f149c8257c52bf5cc43f to your computer and use it in GitHub Desktop.
Save pattonwebz/b7f0a4f29530f149c8257c52bf5cc43f to your computer and use it in GitHub Desktop.
Add a small banner of text to the header for dev/staging servers.
<?php
/**
* Adds a small banner of text when on specific domains.
*
* @return string of html or empty string
*/
function pwwp_output_text_on_dev_or_staging_server() {
$output = '';
if ($_SERVER['SERVER_NAME'] === "staging.domain.com") {
$output = '<div style="background:#fe5353;color:#ffffff;font-size:12px;padding:2px;">Staging Server</div>';
} elseif ($_SERVER['SERVER_NAME'] === "dev.domain.com") {
$output = '<div style="background:#ffc424;color:#ffffff;font-size:12px;padding:2px;">Dev Server</div>';
}
// if we have outout to return - return it.
if ( $output ) {
return $output;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment