Created
July 7, 2016 18:32
-
-
Save robertpassaro/286c742087ae5ba5db2678a037c70c64 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
/* | |
* WORDPRESS | |
* Template tag that echoes a notice that there is an SSL connection on the current page. Returns false if not. | |
* | |
* @param (string) $text Optional. The text to be displayed if there is an SSL connection. | |
* @param (bool) $icon Optional. If true, echos a span for a lock icon. | |
*/ | |
function the_secure_connection( $icon=true, $text='Secure connection' ) { | |
if ( !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ) { | |
$html = '<div class="ssl-ok">' . $text; | |
if( $icon ) { | |
$html .= '<span class="icon-lock"></span>'; | |
} | |
$html .= '</div>'; | |
echo $html; | |
} else { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment