Twitter Cards for WordPress

I recently decided to experiment with Twitter cards for WordPress. Twitter cards allow you to explicitly define a unit of information: an article, a recipe, an event and so on (or if you prefer it in their terms it allows you to ‘attach media experiences to Tweets‘).

This is great for your followers as it gives them more information about the URL you want to send them to. This tweet is with Twitter’s ‘rich snippet’ card enabled:

Twitter Cards for WordPress

Needs the description variable changing to use an article summary!

This sort of extra information in meta-tags is great for SEO too, provided you follow one of the standards, such as schema.org. Search engine crawlers try to guess what your page is about. Whilst content can be immediately obvious to a human, the different ways of writing, say a recipe, may confuse a crawler. Remove all doubt and specify each section of information. Do it correctly and be rewarded (largely on Google’s whims) with extra information when you appear in the search results. This can really drive your click through rate even in lower results positions. This article, however, is about getting Twitter cards working, I’ll tackle rich snippets in a wider sense another time, or you could just read this excellent Moz article which covers the topic in great detail. If you sell things, provide content or care about your SEO at all you really need to start implementing any relevant tags you can.

Mine could do with some improvements, but first let me outline the process by which you enable Twitter cards and how specifically to do it on WordPress sites. From the previously linked Twitter Dev section (log-in with your standard user credentials):

“ Review the documentation for the type of card you want to implement.

  1. Add the pertinent meta tags to your page.
  2. Run your URLs against the validator tool to be approved.
  3. After approval, tweet the URL and see the Card appear below your tweet.”

Sounds easy! All you have to do is look up the required tags for the card(s) you want and add the information into meta tags in your HTML <head> section. Well it’s not entirely that straightforward, I found Twitter’s explanation a little basic so I went looking for more information. This page was rather helpful.

You could play around in your header.php file in order to add these, but I’ve found it problematic between versions to finding the variable names for article titles, descriptions etc, so I used this plugin and filled in all my details in my WordPress backend, under the Article tab of the plugin.

My Twitter card tags:

<!-- Twitter Card -->
 <meta name="twitter:card" value="summary">
<meta name="twitter:creator" value="@owenradford">
<meta name="twitter:url" value="http://www.owenradford.co.uk/5-resources-for-getting-the-most-out-of-magento/">
<meta name="twitter:title" value="5 Resources for getting the most out of Magento">
<meta name="twitter:description" content="- Websites &amp; SEO for your business">
<meta name="twitter:image" value="http://www.owenradford.co.uk/wp-content/uploads/2013/07/owen-radford.jpg" />

After this I still wasn’t passing validation unfortunately as the description wasn’t coming through. I think WordPress’ php function for this may have changed since the guides I was using were written, so with a little more digging I was able to find the solution for my problem:

<meta name=”twitter:description” content=”<?php bloginfo(‘description’) ?>”>

After this I passed validation and applied for my card. A couple of things to note at this point:

  1. When I first applied I was turned down despite passing validation. I applied again and it went through pretty quickly.
  2. Though being accepted it took another week or two for the cards to show up BUT the Twitter Dev forums show a lot of people who’re accepted but not having the card appear even after waiting, so keep an eye on it!
  3. Once the cards were applied they worked retrospectively – other Tweets mentioning my content now have the card working.

There’s still some work to do. As you’ll note the card could do with an article summary or snippet to make it more clickable – my blog’s tagline won’t exactly draw people in!

As I do this I’ll update the article and share new images of how the cards look.

Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA
Reload the CAPTCHA codeSpeak the CAPTCHA code