I like to do it without needing an (extra) plugin.. ??
The link you send me is the same as in my own post.
How to set it up, that is my question. First add the code to my functions.php and then use the short codes instead of my usual mailto links?
ThaNk you,
Alwin
/**
* Hide email from Spam Bots using a shortcode.
*
* @param array $atts Shortcode attributes. Not used.
* @param string $content The shortcode content. Should be an email address.
*
* @return string The obfuscated email address.
*/
function wpcodex_hide_email_shortcode( $atts , $content = null ) {
if ( ! is_email( $content ) ) {
return;
}
$content = antispambot( $content );
$email_link = sprintf( ‘mailto:%s’, $content );
return sprintf( ‘%s‘, esc_url( $email_link, array( ‘mailto’ ) ), esc_html( $content ) );
}
add_shortcode( ’email’, ‘wpcodex_hide_email_shortcode’ );
I have not changend anything in this code. That is correct?
Then I have added the shortcode in my wordpress text area.
Now when I look at the website page I see my email address and when I put the mouse over the email address I still see normal mailto:[email protected] link under in the browser. Is that how it suposed to be?
When I look in the source code I see that my email address is indeed encoded.
Everything okay like this?
]]>??
]]>