What is vCard and how to generate vCard from WordPress

What is vCard and how to generate vCard from WordPress

You may have seen a vCard attached to e-mail note which someone has sent you. vCard is a file format standard for business cards in electronic form.

What is vCard?

vCard is the abbreviation for Virtual Business Card (.vcf file). vCard was developed by a consortium founded by IBM, Siemens, Apple and AT&T which turned the specification over to an industry group, the Internet Mail Consortium (IMC) in 1996. The vCard specification makes use of the “person” object defined by the CCITT X.500 Series Recommendation for Directory Services and can be considered an extension of it.

Because vCard is a published with industry specification and it is a standard, there are many applications available that process it. These applications letting you view them, or drag-and-drop them to an address book or some other application.

vCard can contain information like

  • Name
  • Address
  • Phone numbers
  • Email addresses
  • URLs
  • Logos and Images
  • Audio clips
  • etc…

View or generate vCard

To view a vCard that someone has send you as attachment to an e-mail, your e-mail application/program needs to support vCards. Because not all such programs do yet. However, if you have an online address book or personal information manager that supports vCards, you can move it to that program for viewing. Today almost all email application/clients are supporing vCards.

How to generate for contact information:

  • Click on Address Book
  • Find and Click on the contact you want to send
  • From the Contact menu, click “Forward as vCard”
  • Enter the name of the person to whom you want to send the contact information and complete the message
  • Click on Send Now

How to add to address book:

  • Open up the message having the vCard
  • Click on Address Book
  • Drag the vCard to the Address Book list, the information will be automatically filled with vCard

Available versions of vCard and examples

Reference: https://en.wikipedia.org/wiki/VCard

More on format specification: https://tools.ietf.org/html/rfc6350

1. vCard 2.1

FN:Forrest Gump
ORG:Bubba Gump Shrimp Co.
TITLE:Shrimp Man
TEL;WORK;VOICE:(111) 555-1212
TEL;HOME;VOICE:(404) 555-1212
ADR;WORK:;;100 Waters Edge;Baytown;
     LA;30314;United States of America
     LA 30314=0D=0AUnited States of America
ADR;HOME:;;42 Plantation St.;Baytown;
     LA;30314;United States of America
     LA 30314=0D=0AUnited States of America

2. vCard 3.0

FN:Forrest Gump
ORG:Bubba Gump Shrimp Co.
TITLE:Shrimp Man
TEL;TYPE=WORK,VOICE:(111) 555-1212
TEL;TYPE=HOME,VOICE:(404) 555-1212
ADR;TYPE=WORK:;;100 Waters Edge;Baytown;
     LA;30314;United States of America
LABEL;TYPE=WORK:100 Waters Edge\nBaytown\,
     LA 30314\nUnited States of America
ADR;TYPE=HOME:;;42 Plantation St.;Baytown;
     LA;30314;United States of America
LABEL;TYPE=HOME:42 Plantation St.\nBaytown\,
     LA 30314\nUnited States of America

3. vCard 4.0

FN:Forrest Gump
ORG:Bubba Gump Shrimp Co.
TITLE:Shrimp Man
ADR;TYPE=work;LABEL="100 Waters Edge\nBaytown,
     LA 30314\nUnited States of America":;;100 Waters Edge;Baytown;
     LA;30314;United States of America
ADR;TYPE=home;LABEL="42 Plantation St.\nBaytown,
     LA 30314\nUnited States of
 America":;;42 Plantation St.;Baytown;
     LA;30314;United States of America

Sample code on how to generate vCard from WordPress post

require_once ('wp-load.php');

$vpost = get_post($_REQUEST['pid']);
$featured_image = wp_get_attachment_url(get_post_thumbnail_id($vpost->ID));

/* Instantiate a new vcard object. */
$vc = new vcard();
$vc->class = "PUBLIC";

/* Fill in data for vCard */
$vc->filename = strtolower(str_replace(" ","-",$vpost->post_title));
$vc->data['first_name'] = $vpost->post_title;
$vc->data['company'] =  get_field('company_name',$vpost->ID);;
$vc->data['department'] =  get_field('department',$vpost->ID);
$vc->data['title'] = get_field('expertise',$vpost->ID);
$vc->data['office_tel'] = get_field('phone',$vpost->ID);
$vc->data['email1'] = get_field('email_address',$vpost->ID);
$vc->data['url'] = get_field('linkedin_profile_url',$vpost->ID);
$vc->data['photo'] = $featured_image;
$vc->data['note'] = strip_tags($vpost->post_content);

/* Generate card and send as a .vcf file to user's browser for download. */

Download complete source code: http://freelancer-coder.com/vCard.zip

Speak Your Mind


I’ve worked with Ashish for a couple years now and have enjoyed consistently great results. He’s easy to work with, attentive and reliable. He brings a diverse set of web development skills to the table and has excelled at every project we’ve engaged him on. I highly recommend him.

Ash is awesome to work with, he makes sure he understands the project and delivers beyond expected work with precision on time delivery. Ash and his team is great to work with and I highly recommend them. Working with Ash you dont have to worry about the final product cause they also do QA before its delivered to your server. Great JOB Ash being great working with you.

Ashish is a good resource for our team. We have been working with him for the past 5 years and delivers work on time. He’s always ready to go an extra mile to please our clients. Hope to continue working together!

Ashish is a professional who meets the agreed schedule. He is always well disposed to help. Is a very kind person. He is a professional with excellent technical level.

I have been looking for a great developer for a while now, and I was very happy to find Ashish. He does great work, and meets deadlines on a consistent basis. He requires very little oversight, as everything is typically done 100% correct the first time. I absolutely recommend Ashish as a developer.

Ashish and his team did a wonderful job on our company website. The project was reasonably priced, he finished it on time, and it is just as functional as it is beautiful. Our website is an essential part of our business, and we get compliments on it all the time. I would highly recommend Ashish for website development.

Ashish and his team were creative, responsive, and worked within our budget to create a fantastic looking website that has all the functionality we wanted. He is so talented, we feel lucky to have found him. I HIGHLY recommend him to anyone looking for a website developer.

Ashish does all my web stuff. Fast and does a brilliant job. Thanks Ashish, great work.

Ashish is an amazing programmer. He is quick to help and very knowledgeable. I feel confident taking almost any issue to him and he is able to work through it. Very friendly and professional.

Ashish is very thorough and we really like working with him. He will be a great asset to any organization.

Free and best WP plugin to analyze your site with the help of charts.
WP Show Stats plugin

+91 9033402074

Freelancer Coder
238, Back Bone Shopping Center,
Chandresh Nagar Main Road,
Mayani Chowk, Rajkot - 360004,
Gujarat, India