Twitter Cards are quite the rage now when it comes to sharing your stuff on Twitter. They add that zing to sharing. But there are loads of plugins for WordPress already, so why did I create my own?
Well, here’s the brief rundown:
- The ones I saw, none of them are WordPress.com VIP compliant
- Most just get the job done but the code is well….. unhealthy!
- The ones I saw, none supported player card
- I needed filters to be able to override the output etc. fully or partially
- Being the attention seeking douche I am, I wanted to roll my own plugin 😀
Its all pretty easy and neat to use. Just activate the plugin, set a few global options on plugin settings page and done. By default it produces summary card tags for all posts and pages. If you want finer control or want player card for any post or page then select the global option for control on post pages and it will provide a meta box on post/page add and edit pages in wp-admin where you can set card to player card.
Here are a few things to remember:
- You must set an excerpt for post/page. If its not set then plugin will generate one from content.
- Better set an image in posts/pages in the plugin meta box else it’ll try to use fallback image if you set it in plugin options.
- Player cards need domain whitelisting from Twitter, so get your application to them.
That’s it. If you want to override anything plugin does then you can hook into filters provided in it. I might write a post about them sometime in near future.
And here are the download links:
- At WordPress plugins repo: http://wordpress.org/extend/plugins/ig-twitter-cards/
- Github: https://github.com/coolamit/ig-twitter-cards
Pull requests are of course welcome at Github. :tup: