How to Add Rich Contact Information in WordPress
Web search engines like Google or Bing are trying to pull more and more semantic from the content of the websites they index every day. Specific markups like microdata and microformats have been created to help search engines understand the meaning of your content. Search engines utilize this data to provide additional information on the search results page. Having rich snippets in search has shown to improve click through rate. In this article, we will show you how to easily add rich contact information in your WordPress site, so they can be displayed as rich snippets in the search results.
What are rich snippets for contact?
You may have already seen these rich snippets without even knowing. It adds relevant contact data like address, city, phone number, etc below the description when a website appears in search results page. Here is an example:
Why should I care?
That’s a good question. Rich snippets can be a great help to show that your content is relevant to the user’s search query. It can increase the CTR (Click Through Rate) of your page in the search results. This is also a great way to stand out against your competitors on your selected keywords. Often local small businesses are behind the curve, so if you are one of the savvy small business owners, then make sure to implement this technique on your site.
How to add rich contact information in WordPress
We will take a look at two methods to insert rich contact information on your WordPress site. One will require a plugin, and the other would be the hard coded method.
Method 1 : with the Rich Contact Widget plugin
The easiest way is by using the Rich Contact Widget plugin. After installing and activating the plugin, go to Appearance » Widgets submenu. You will be able to add the Rich Contact widget in one of the widget areas of your theme. Fill out all your contact information, and let this plugin take care of the required markup for rich snippets.
Additionally, you can display an image map of your location, and provide a download link for a vCard containing your contact data. These are just options for your website visitors, and can be deactivated in the widget configuration.
Method 2: Hard coded in your theme
This method requires to edit your WordPress theme files, where you want the contact information to display. The example below will show you how to add both microdata and microformats, but you can use only one of them (microdata is the recommended one by Google).
<ul class="vcard" itemscope itemtype="http://schema.org/Corporation"> <li class="fn org" itemprop="name"><strong>Your company name</strong></li> <li itemprop="description">Your activity</li> <ul class="adr" itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"> <li class="street-address" itemprop="streetAddress">Your address</li> <li><span class="locality" itemprop="addressLocality">City</span> <span class="region" itemprop="addressRegion">State</span> <span class="postal-code" itemprop="postalCode">Zip Code</span></li> <li class="country-name" itemprop="addressCountry">Country</li> </ul> <li class="tel" itemprop="telephone">Your phone number</li> <li class="email" itemprop="email"><a href="<?php antispambot( 'firstname.lastname@example.org' ) ?>">email@example.com</a></li> </ul>
Microformats uses the class attributes to markup the data, while microdata uses itemtype and itemprop attributes. Detailed information for microdata markup can be found on the schema.org website, same for microformats with the hCard markup.
You can also see there is a function called antispambot() used in this code. It’s a WordPress specific function to protect your email address from spam bots crawling the web. A non-well know function but it is very useful.
Testing for structured data on your website
After utilizing one of the methods above, search engines will be able to get rich snippets data from your website. You can test it on this page by Google. Enter the url you want to preview, and all the structured data extracted will be displayed.
And you are done, search engines will now be able to pull rich information data from your website, and after a while it should display on the search results pages. Feel free to comment for any suggestions or questions.