hCard & vCard Generator WordPress Plugin

hCard & vCard Generator WordPress PluginThe hCard & vCard Generator plugin was created to solve one specific problem, generating Microformats compatible hCards from WordPress users and companion vCards for downloading purposes.

The plugin also beefs up the user profile section with new fields for organisation, job title, phone, fax and mobile numbers as well as address.

Finally, this plugin also comes with a widget to allow easy adding to your sidebar.

Get the most stable version: Download hCard & vCard Generator plugin from the WordPress.org Plugins repository

Installation:

1. Upload the plugin to the `/wp-content/plugins/` directory
2. Activate the plugin through the ‘Plugins’ menu in WordPress
3. PlaceĀ in your templates where $userID is the user’s ID and $cardType is either “hCard” or “vCard”, or use the provided hCard vCard widget in the sidebar, or thirdly you can use shortcode to insert into posts/pages. See below:

For example to generate the hCard for admin use:

<?php echo generate_card(1, 'hCard'); ?>

To generate the vCard for admin use:

<?php echo generate_card(1, 'vCard'); ?>

Alternatively, as of version 1.2 you can display the widget via shortcode:

[hcardvcard title="Testing Title" user="1" display_vcard=true display_hcard=true]

All attributes for the shortcode are optional, the current author gets used if no user value is given.

There is also a Widget included for easy use in the sidebar.

You can use the login name for the user value with the shortcode or widget rather than the ID, but calling the generate function directly requires the User ID.

Examples of format outputs:

vCard Format:

BEGIN:VCARD
VERSION:3.0
N:Kohlbach;Josh;
FN:Josh Kohlbach
URL;TYPE=WORK:http://rymera.com.au
PHOTO;ENCODING=b;TYPE=JPEG:[YOUR PHOTO BASE64 ENCODED HERE]
ORG:Rymera Web Co
NOTE:
TITLE:Director
TEL;TYPE=WORK,VOICE:1234567890
TEL;TYPE=WORK,FAX:1234567890
TEL;TYPE=CELL,VOICE:1234567890
EMAIL;TYPE=PREF,INTERNET:josh@example.com
ADR;TYPE=WORK:;;1 Fake St;FakeCity;State;1234;Country
END:VCARD

hCard Format:

<div>
<img src="http://example.com/josh.jpg" class="photo" alt="Josh Kohlbach">
<div class="title" style="display:none;">Director</div>
<div class="org url">
<a href="http://rymera.com.au">Rymera Web Co</a></div>
<div class="adr">
<div class="street-address">1 Fake St</div>
<span class="locality">FakeCity</span>,
<span class="region">State</span> 
<span class="postal-code">1234</span> 
<div class="country-name">Country</div>
</div>
<div class="tel"><span class="type work">Phone: </span> 1234567890</div>
<div class="tel"><span class="type cell">Mobile: </span> 1234567890</div><div class="email" style="display:none;"><a href="mailto:josh@example.com">josh@example.com</a></div>
<div class="vcard_button">
<a href="http://example.com/josh.vcf">vCard</a>
</div>
</div>