WP 2.7 fun: complete hcards

WordPress 2.7 has an awesome new thing: it turns the comments into hCards by default. An hCard is the microformat version of a vcard, which, with microformat extensions for your browser, you can then save the data of those commenters in your address book.

For instance, with the Safari microformats plugin, this looks like this:

microformats in WordPress with Safari

If you use Firefox, you should check out Operator for the same functionality.

The only issue is, that the hCards don’t contain email addresses. This is obviously good, as you wouldn’t want to share everyone’s email addresses on your blog, but as an admin or editor, you’d love for those to be included by default right?

Well, (you’ve guessed it) I’ve written a small plugin that does just that. If you’re allowed to edit the current post, and thus the comments, the email addresses will be added to the comments section, invisibly. If you use the hCard though, they’re there, so you can directly save them to your address book. The record will then contain name, website, email address and photo (gravatar in most cases) for the user. Cool huh?

Download the plugin here.

To answer a question I’ve made a quick screencast:

Tags: ,


Yoast.com runs on the Genesis Framework

Genesis theme frameworkThe Genesis Framework empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides you with the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.

Read our Genesis review or get Genesis now!

10 Responses

  1. Michael HenryBy Michael Henry on 13 December, 2008

    Just like visiting Grandma’s house: I find a picture of me and I’m crossed out! Ha!

    Anyway, I don’t use hcards or vcards and I’m sure others don’t also. What would be gained with the inclusion of the email addresses? Just an easier way to create a mailing list?

    • Joost de ValkBy Joost de Valk on 13 December, 2008

      No, a quicker way to save the details of someone who commented on your blog to your address book for later reference :) I’ll make a quick screencast of what it does.

    • Joost de ValkBy Joost de Valk on 13 December, 2008

      I’ve made a quick screencast Henry, it’s in the post now, hope this answers your question?

  2. Farrhad ABy Farrhad A on 14 December, 2008

    This will be helpful :)
    Will install it today

    • Joost de ValkBy Joost de Valk on 14 December, 2008

      Cool, let me know if it works for you. Do note that you have to use the 2.7 comment style to be able to use this.

  3. Prepaid Cell Phone GuyBy Prepaid Cell Phone Guy on 14 December, 2008

    Hello,
    I just found your blog. I have just started using WordPress and so far great. Many of your posts are over my head but more of them would have been two weeks ago. Thank you for your “classes” on WordPress.

  4. kOoLiNuSBy kOoLiNuS on 16 December, 2008

    really interesting … I’ll try it :-D

  5. LynneBy Lynne on 17 December, 2008

    The implementation of the hcards is not correct unfortunately. The link relationship should be fn url, but WP is splitting this into an fn class and adding url into the link itself. While some microformat readers may be able to understand this it just plain doesn’t make sense. hcards are also supposed to be tied to a name. Therein lies a real problem because while some people will use a real name in comments, most use a nickname or partial name. This could be worked around by adding a field to the comments form for people to select from either real name or nickname and then the appropriate microformat could be applied.

    Like the WAI-ARIA implementation in 2.7, the implementation of hcards seems to have been poorly thought out. I’m sorry to see that this is included in WP by default as a badly formed hcard is really worse than none at all.

  6. Will NorrisBy Will Norris on 17 December, 2008

    @Lynn: Actually the WordPress hCard implementation is just fine. You wrote:

    The link relationship should be fn url, but WP is splitting this into an fn class and adding url into the link itself. While some microformat readers may be able to understand this it just plain doesn’t make sense.

    What about that doesn’t make sense? Name and URL are two different attributes, so why should one assume that they are always combined? The reason for them being split like this is because not all commenters leave a URL. In that case, only the cite tag with the “fn” class will be present… there is no a tag. While it is slightly different, you can see a similar example on the microformats wiki.

    hcards are also supposed to be tied to a name. Therein lies a real problem because while some people will use a real name in comments, most use a nickname or partial name. This could be worked around by adding a field to the comments form for people to select from either real name or nickname and then the appropriate microformat could be applied.

    This is actually not necessary… the hCard spec already handles it. Read the Implied “nickname” optimization section (as well as Implied “n” optimization above that). Depending on the value of the “fn” attribute, different things are implied. Could it be made more explicit so there is less ambiguity? Absolutely, but why clutter up the commenting interface with another input field for something so minor?

  7. trashfamousBy trashfamous on 5 October, 2009

    Just found your video on vimeo. Thanks for sharing this. I have to think about implementation in my blog.