[resolved] email address (3 posts)

  1. metrocitizen
    Posted 3 years ago #

    How can I enable an email address to be clickable?

  2. esmi
    Forum Moderator
    Posted 3 years ago #

  3. Ihor Vorotnov
    Posted 3 years ago #

    Better use it right way. WordPress has core function antispambot() which obfuscates your email address 'hiding' it from spam bots. Also, you don't need to hardcode the email address into template, this code automatically picks up blog admin email.

    <a class="email" href="mailto:<?php echo antispambot( get_bloginfo('admin_email', 'raw'), 1 ); ?>?subject=Hello" target="blank"><?php _e('Contact me', 'your_text_domain'); ?></a>

    To hardcode custom email address into temlate use this:

    <a class="email" href="mailto:<?php echo antispambot('info@yourdomain.com', 1 ); ?>?subject=Hello" target="blank"><?php _e('Contact me', 'your_text_domain'); ?></a>

    replace info@yourdomain.com with the email you want to insert.

Topic Closed

This topic has been closed to new replies.

About this Topic