Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save robertpassaro/286c742087ae5ba5db2678a037c70c64 to your computer and use it in GitHub Desktop.
Save robertpassaro/286c742087ae5ba5db2678a037c70c64 to your computer and use it in GitHub Desktop.
/*
* 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