WordPress.org

Ready to get started?Download WordPress

Forums

Authors email address in posts (5 posts)

  1. profis
    Member
    Posted 8 years ago #

    Apologies if this is a dumb question but I've looked everywhere and cant find out how to automatically add the author's name and email address to a post

    Can anyone help please?

  2. Christopher J. Hradil
    Member
    Posted 8 years ago #

    you just need to add -

    <?php the_author_posts_link() ?>

    see http://www.hradil.us for example, authors name appears as link.

  3. Christopher J. Hradil
    Member
    Posted 8 years ago #

    actually, that's the authors name as a link to his other posts, but this:

    <?php the_author_email() ?>

    returns the authors email address, so i would use something like:

    posted by <?php the_author_posts_link() ?> who can be contacted at <?php the_author_email() ?>

  4. CharlesKrause
    Member
    Posted 8 years ago #

    I would also adjust the comments form so that authors know they are posting their email!

    Spam bots harvest those too, you know.

  5. Christopher J. Hradil
    Member
    Posted 8 years ago #

    a quick note, the code that I posted above isn't for the comments, it's for the author of the original blog post.

    if you're looking for the same info/style for comments, you need to use -
    <?php comment_author_link() ?> for the comment author's name with link to profile,
    <?php comment_author_email() ?> will display authors email address.
    <?php comment_author_email_link() ?> as above but is a link.

    other comment related filters/template tags are:
    comment_author_IP
    comment_author_url
    comment_author_email_link
    comment_author_url_link
    comment_author_link

    documentation for hooks/filters and template tags can be found here:

    http://codex.wordpress.org/Plugin_API

    As far as the spam bots/harvesters, it's easy enough to "encode" the email addresses similar to the way that moveable type does (in the html the actual html character codes are used, but they render as a human readable email address/link), the bots/harvesters can't touch them.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.