How To Setup Twitter Cards for WordPress
As Twitter becomes one of the main content distribution platforms many of us now use to consume media on a daily basis – publishers and marketers should look at every possible avenue to give their content the highest chance of success and share-ability.
One way to give your content extra prominence on Twitter is by implementing Twitter Card support.
What exactly does this mean? When you preview a tweet with Twitter Card support you can see a preview of the content, author and picture.
Eg this Tweet by SAI:
So how exactly do you implement Twitter Cards? There are a few plugins you can use in WordPress but it’s always best to avoid plugins if possible.
The code to implement Twitter cards is rather simple. You need to place 7 unique Twitter fields in the <head> tag of your website.
1. <meta name=”twitter:card” content=”summary”/>
Leave this field always as summary. This means you will show a summary of your content, including both text and picture.
2. <meta name=”twitter:creator” content=”@SMN_Australia”/>
This next field is the Twitter username of the author/ writer / creator of the content. With a few simply WordPress PHP scripts you can pull the authors Twitter handle into this field.
3. <meta name=”twitter:site” content=”@SMN_Australia”/>
This field is the Twitter account of the website. This can be hard-coded to be always the same value as it will never change.
4. <meta name=”twitter:url” content=”https://www.socialmedianews.com.au/social-media-statistics-australia-january-2013/”/>
This is the URL of the current page and simple Get Permalink WordPress PHP function will do the job quickly and easily.
5. <meta name=”twitter:title” content=”Social Media Statistics Australia – January 2013″/>
This is the title of the current page and simple Get Title WordPress PHP function will again do the job.
6. <meta name=”twitter:description” content=”It is now time to report our Australian social media statistics for January 2013.Summer holidays in Australia has a significant impact on the social networking sites we use. Generally over the December holiday period we see …”/>
The description field is a short summary of your content and can simply be pulled using the WordPress excerpt PHP function.
7. <meta name=”twitter:image” content=”https://www.socialmedianews.com.au/wp-content/uploads/2013/02/socialmedianewsaustraliaiphoneapp.png”/>
The last field is the image to show in the summary. To suffice simply pull the first image attached to the post, or a featured image. If not suitable then hard-code a generic image to be used as a backup.
One you have setup the code, test it on the Twitter Card Preview Tool.
Twitter then will show you a preview of your Twitter Card:
Looks good? Now apply to Twitter to have this functionality turned on for your website. You will need to fill out this Twitter Developer Form. You will have to wait for approval from Twitter before this goes live.
Any publisher than uses Twitter as a marketing avenue will benefit from this tweak. It may also be worth for larger social media agencies and consultancies to implement this and get their content standing out even further.