Mailto image (4 posts)

  1. pcolonna
    Posted 8 years ago #

    I don't particularly like having to use a contact form for my WP Italian blog, so I'm trying to use an old-skool trick and insert a little text image (GIF) in my header with my blog's address, to fool harvesters.

    I added a mailto link to my text image, using the the WP function to disguise email adresses from spammers, like this (in my header.php file):

    <a href="mailto:<?php echo antispambot(get_the_author_email()); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/mailto.gif" alt="..." /></a>

    Unfortunately the link opens a new message window in my e-mail application as it should, but no address is displayed.

    I checked, and the address is correctly listed in my admin profile.
    What am I doing wrong? :-(
    Any help appreciated.

  2. pcolonna
    Posted 8 years ago #

    Bah. I posted this in the wrong section, it should be in "troubleshooting", obviously. :-(

  3. Berhune
    Posted 8 years ago #

    I have this problem also..

    the_author_email() doesn't seem to work in a link attached to an image.

  4. pnaw10
    Posted 8 years ago #

    Are you sure you're using this within The Loop??

    According to http://codex.wordpress.org/Template_Tags/the_author_email you can only use <?php the_author_email(); ?> (or any modification of such) within The Loop.

    If you're using it in a widget, header, footer, etc., it will not work.

Topic Closed

This topic has been closed to new replies.

About this Topic