WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Antispambot and admin_email question (10 posts)

  1. obeattie
    Member
    Posted 8 years ago #

    Hi All,

    I am currently writing a theme and wanted to make it the best it can be. I am writing the 404 error page, and want to include a link to email the webmaster. I was wondering if it is possible to run the bloginfo('admin_email') through antispambot in something like this? :

    mailto:<?php antispambot(bloginfo('admin_email')); ?>

    Is that possible or is it just wishful thinking?

    Any help would be much appreciated.
    Many Thanks,
    Oliver

  2. Austin Matzko
    Member
    Posted 8 years ago #

    What I think you're missing is the echo. See this thread:
    http://wordpress.org/support/topic/42718

  3. obeattie
    Member
    Posted 8 years ago #

    OK. So would:

    mailto:<?php echo antispambot(bloginfo('admin_email')); ?>

    work? I just didn't think that you would be able to nest the bloginfo command...?

  4. obeattie
    Member
    Posted 8 years ago #

    Or would I need:

    mailto:<?php echo antispambot(bloginfo('admin_email);); ?>

    ??

  5. Kafkaesqui

    Posted 8 years ago #

    Try:

    mailto:<?php echo antispambot(get_bloginfo('admin_email')); ?>

  6. obeattie
    Member
    Posted 8 years ago #

    No: that just returns mailto:~this is blank~

    Any other suggestions?

    I have tried the antispambot(bloginfo('admin_email')); too, but that doesn't encode the address, just returns it in plain text.`

  7. Kafkaesqui

    Posted 8 years ago #

    "...but that doesn't encode the address, just returns it in plain text."

    Because bloginfo() cannot be used the way you're trying to use it; it only *echoes* output and doesn't return it back to your code. The one I suggested, get_bloginfo(), does exactly what bloginfo() does, only it returns any output. If that returned value happens to be empty, then something else is amiss.

  8. obeattie
    Member
    Posted 8 years ago #

    WHat could cause this?

  9. Kafkaesqui

    Posted 8 years ago #

    Well, usually something missing in some part of the code. As a test, what do just:

    <?php bloginfo('admin_email'); ?>

    and

    <?php echo get_bloginfo('admin_email'); ?>

    display?

  10. obeattie
    Member
    Posted 8 years ago #

    Hi There,

    I am so sorry.. I missed out the echo (Doh!)

    Many Thanks for all your help, with the echo it all works fine now!

    Many Thanks again,
    Oli

Topic Closed

This topic has been closed to new replies.

About this Topic