Last active
October 9, 2017 17:37
-
-
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.
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 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