lisaleague
6/9/2015 - 3:14 PM

Protect email from spambots

Protect email from spambots

/** Protect email address from Spambots, use with [mailto]email@yourdomain.com[/mailto] */
function my_mail_shortcode( $atts , $content=null ) {     for ($i = 0; $i < strlen($content); $i++) $encodedmail .= "&#" . ord($content[$i]) . ';';      return '<a href="mailto:'.$encodedmail.'">'.$encodedmail.'</a>'; } add_shortcode('mailto', 'my_mail_shortcode');