Skip to content

Instantly share code, notes, and snippets.

@norcross
Created October 1, 2012 15:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save norcross/3812557 to your computer and use it in GitHub Desktop.
Save norcross/3812557 to your computer and use it in GitHub Desktop.
Obfuscate email shortcode
/*
Usage (on the HTML tab, not the visual editor)
[email address="you@emailcompany.com"]
*/
function emailbot_ssc($attr) {
extract( shortcode_atts( array(
'address' => '',
), $attr ) );
$email = '<a class="email_link" href="mailto:'.antispambot($attr['address']).'" title="Send Us An Email" target="_blank">';
$email .= antispambot($attr['address']);
$email .= '</a>';
return $email;
}
add_shortcode('email', 'emailbot_ssc');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment