How To Add A vCard Download To A WordPress Site

vcardRecently a client asked us if we would add links to their staff’s vCards to the WordPress site that we had just designed and developed for them. We had never done it before, but it didn’t seem like a big deal. In the words of Indiana Jones—“How hard can it be?” We’ll just add the vCards to the Media Library and link to them.

We soon found a fix that wasn’t a hack and didn’t involve a plugin, but, in our case, it required several steps and there was no one place on the internet (well, we couldn’t find one) that mentioned all the steps in one article. So we decided to write one.

Step One

The first thing we found was that you cannot upload vCards (.vcf files) to the WordPress Media Library. WordPress only allows certain file types to be uploaded and .vcf is not one of them. Regardless of the method used trying to upload a vCard results in the error message “This file type is not allowed. Please try another.”

After a little research we found that by adding some code to a theme’s functions.php file we could add functionality that would support uploading a .vcf file. We added the following code to the functions.php file:

// Allow .vcf files to upload to the media library
 add_filter('upload_mimes', 'custom_upload_mimes');
 function custom_upload_mimes ( $existing_mimes=array() ){
 // add your extension to the array
 $existing_mimes['vcf'] = 'text/x-vcard'; return $existing_mimes;
 }

It worked, but not as we expected.

Step Two

In some situations, if you click on a link to a .vcf file, the vCard isn’t downloaded. Instead its contents are displayed in the browser window as text. We found that in order to force these files to download correctly we needed to make changes to the site’s .htaccess file.

We added the code line below to the site’s .htaccess file. (If you can’t find your site’s .htaccess file click on the link in the paragraph above for help.)

AddType text/x-vcard .vcf

It didn’t work.

Step Three

Refresh you browser. As simple as it is if you don’t do this stuff every day it’s easy to forget the power of a browser refresh.

After a browser refresh everything worked as expected. We are now able to upload a .vcf file to WordPress, and visitors to the site are able to download them.

Save

Save

Save

Mobile Friendly. Is it Important?

Responsive lineup

Is Your Website Mobile-friendly?

Mobile technologies have changed the way we use and think about the Internet. Today’s websites will be viewed on more devices, more input types, and more resolutions than ever before. Almost everyone has a smartphone, and according to Google, 94% of people using them in the United States will search for local information using their phones. Considering the fact that the number of smartphones has surpassed the number of personal computers, it’s obvious that having a mobile-friendly website is a crucial part of any online marketing strategy. The web has moved beyond the desktop, and it’s not turning back. If your website isn’t mobile-friendly, it should be as many visitors are likely to be using some form of mobile device.

What does Mobile-friendly Mean?

Simply put, a mobile-friendly website is one that displays well on small portable devices like smartphones and tablets, a site built to be easy to read and easy to navigate when viewed on a device with a small display. A site that is not mobile-friendly may still display and function, but visitors will be doing a lot of scrolling, zooming and pinching to interact with it—not a good user experience.

Mobile-friendly And Search Engines.

The bottom line—If your site is not mobile-friendly, there may be a significant decrease in mobile traffic from Google Search, and whether you like it or not Google matters. Google is the #1 search engine on the web, and it got there because of its strong focus on delivering the best results for each search.Their mobile algorithms may affect some types of businesses more than others but in the long run it is going to be advantageous for a web site to be mobile friendly. Keep in mind that mobile doesn’t just mean smartphones. Tablets, phablets, e-readers, are also affected.

How Do You Know If Your Website is Mobile-friendly?

If your site website is three to five years old, or older, it’s likely that it is not mobile friendly, but if you’re not sure one of the quickest and easiest ways to find out is with Google’s Mobile-Friendly Testing Tool.

What To Do If Your Website Is Not Mobile-friendly.

There are several options for making a website mobile-friendly, and while we don’t always agree with Google—on this we do—responsive web design is the best approach to creating a mobile-friendly website. Responsive web design (RWD) is the ability of your website to automatically adjust to (and look great on) any screen size. Advances in coding have enable an approach to web development that’s focused on building sites that provide an optimal viewing and interactive experience—easy reading and navigation with a minimum of resizing, panning, and scrolling across a wide range of devices, from desktop computer monitors to mobile phones.

Conclusion

As you’re planning a new website, or a redesign of an existing one, keep in mind that many of your visitors will be visiting your site from their mobile phones. Responsive web design is not an advantage; it’s an expectation. At Trusty and Company we’ve been creating responsive websites since the technology was introduced, and we know how to create a web presence that gives visitors an ideal experience no matter how they access your site.