Forums

Using antispambot() for mailto out side of loop (5 posts)

  1. EWebwmn
    Member
    Posted 3 years ago #

    I have a client that wants to have an email link on a post. Not on every post. Insted of using this code in the loop:
    <a href="mailto:<?php echo antispambot(get_the_author_email()); ?>">email author</a>


    could I use:
    <a href="mailto:<?php echo antispambot(author@xyz.org); ?>">email author</a>


    in the post?

  2. Kafkaesqui
    Moderator
    Posted 3 years ago #

    Yep. Just make sure to place quotes around the address:

    antispambot('author@xyz.org')

  3. jalenack
    Member
    Posted 3 years ago #

    If you want to run it in a post, you'll need to use a PHP-in-post plugin like PHPExec, The Execution of All Things, CG-QuickPHP, or RunPHP.

    However, if that's all you're going to do, it's probably not worth it. I just whipped up a little tool that'll run antispambot() for you.

    http://code.jalenack.com/antispambot/

  4. EWebwmn
    Member
    Posted 3 years ago #

    Thank you jalenack!
    This looks like it will work for me -just what I needed,
    I am using wordpress 1.2 so I could not use the plugins wp-contactform or others I found (all for 1.5 or higher)

  5. Kafkaesqui
    Moderator
    Posted 3 years ago #

    I really liked jalenack's solution, but it just didn't seem automated enough to me...

    http://guff.szub.net/email-immunizer/

    Oh, it should work with 1.2.

Topic Closed

This topic has been closed to new replies.

About this Topic