v-card wordpress

How to add a V-card (vcf) in WordPress

What are V-cards?

V-cards are text files saved with the .vcf extension, through which you can send your contact details for mobile devices. Basically, they are a kind of digital business card. Once downloaded to your mobile, the file can display your contact details, and if you select the “save contact” option, they will be added to your phonebook.

How to create a V-card file?

To get started, you can customize the following code:

BEGIN:VCARD
VERSION:4.0

N:Ioan;Popescu;;Dr.;
FN:Dr. Popescu Ioan
EMAIL:contact@popescuioan.ro
ORG:Popescu Ioan SRL
TEL:+40700 000 000
URL;type=pref:https://popescuioan.ro
ADR:;Municipiul Iasi, B-dul Popescu Ioan, Nr. 1;;Iasi;Iasi;700028;Romania
END:VCARD

Replace your contact information with your own:

  • after N: and FN: you will pass the first name, last name and title, separating them by “;” as shown in the example above
  • at “EMAIL:” fill in your personal mailbox address.
  • after ORG: and TEL: specify the institution you represent and the phone number you use
  • URL; – website address
  • ADR: physical address

After you have finished customizing, save the .vcf file.

How do I upload the file to WordPress?

By default, WordPress does not allow files to be uploaded unless they contain the following extensions:

-Images: .jpg, .png, .gif, .jpeg, ico

-Documents: .pdf, .doc, .ppt, .odt, .xls, .psd

-Audio: .mp3, .m4a, .ogg, .wav

-Video: .mp4, .mov, .avi, .mpg, .ogv ,. .3gp, .3g2

In other words, if you try to upload a .vcf file from the “media library” section, you will get a return error.

In order to upload a .vcf file, you will need to open the functions.php file in the theme folder that you have active in Cpanel or via FTP. Once the file is open, enter the following code and save the file with the changes made:

function enable_vcard_upload( $mime_types=array() ){
	$mime_types['vcf'] = 'text/vcard';
	$mime_types['vcard'] = 'text/vcard';
	return $mime_types;
}
add_filter('upload_mimes', 'enable_vcard_upload' );

After entering this code and saving the file, you will see that you are now allowed to upload the file.

To insert a button in the pages through which visitors can download the new “business card”, simply create a button in the page editor and assign the link to the file (you can find it in the “media library” section).

Share: