Both WordPress and Twitter have experienced huge surges in popularity of late and these days it’s important to have a solid presence on both of the platforms. In this post we’ll look at the eight ways to integrate WordPress and Twitter.
1. Add a ‘share on Twitter’ button to posts (and count clicks) without a plugin
There are a couple of ways to make a ‘share on Twitter’ button and we’ll discuss three of these ways in this post. The first of these ways is plugin-less and looks pretty cool too! ReTweet.com was launched a couple of months ago and it allows you to add a Digg like button to any WordPress theme. Adding it to any WordPress theme is really easy, as I showed on WPShout a while ago – open up your single.php file and add the following code where you want the button to appear:
And with that, you’re done!
2. Add a ‘share on Twitter’ button to posts and your RSS feed (and count clicks) with a plugin
The most popular option for adding a ‘share on Twitter’ button is the Tweetmeme service. Available as a really easy to use plugin, it’s easy to see why the plugin is just about everywhere these days. The big advantage about the plugin is the ease of use – install it and head to the advanced options page and you’ll be confronted with a number of options that let you automatically insert the button into posts, the homepage and your RSS feed. You’re even given the option to change the size of the button!
3. Create your own ‘share on Twitter’ button
We’ve looked at two services that will track the number of times a post of yours has been RT’d, but they aren’t for everyone’s tastes; this next trick will create you your own ‘share on Twitter’ button. All you need to do is choose for one of the many, many Twitter icons out there, rename it to twitter.png, upload it to /your-theme/images/ and then paste the following code in your single.php file where you want the button to appear. You can then change the “RT @” to your Twitter username:
4. Automatically send your posts to Twitter (without a plugin!)
Whilst there are many ways of doing this job with a plugin, the plugin-less way is always invariably better and that applies here – Twitterfeed is a great service that automatically sends your new posts to Twitter. All you’ve got to do is go to Twitterfeed.com, sign up, enter your Twitter account details and your RSS feed and you’re done. You’re given a ton of options including how the URLs are shortened, how the tweets are formatted and the like.
5. Show an ‘about the author’ section
Increasingly and especially on multi-author blogs, an ‘about the author’ section is the norm at the bottom of articles. If you’re wanting to create one you’ve got two options – either with custom fields or with the ‘Your Profile’ section in the WordPress backend. With this created, you’ve got somewhere to plug your Twitter profile within all of your posts!
The first option we’ll run through is using custom fields. This option will be best for blogs with one main author and a number of guest authors who won’t publish more than a couple of posts. What we’ll do is set up a custom field with the main body of the ‘about’ section and another one for the gravatar. Here’s the handy bit though – the main author needn’t set up a custom field every time he or she publishes a post as we’re going to set some default values:
and then we can plop in the gravatar:
This method requires that you fill in the info for the main author and all other authors fill out two custom fields; one with their Gravatar URL – ‘Gravatar’ and the other with some bio – ‘About’.
The second method is more widely documented and takes advantage of the author info fields in the WordPress backend. ThemeForest has a great tutorial on the subject.
6. Twitter Tools
Twitter tools is quite probably the only Twitter plugin you need for WordPress. It’s essentially Twitterfeed but with options to show your latest tweets in the sidebar, create a post with all the tweets you’ve posted throughout the week and a heck of a lot more! Whilst I’m not a fan of doing things the plugin way, it is a great plugin! However, that’s not to say you can’t achieve the same results without the plugin…
7. Show your latest tweets on your sidebar
It’s really easy to show your latest tweets on your sidebar – go to twitter.com/yourusername and on the sidebar copy the URL of the RSS feed of your tweets. Next, in the WordPress backend, click ‘Appearance’ and then ‘Widgets’. Drag and drop the RSS widget onto your sidebar’s widget area and paste the URL of your RSS feed. And you’re done!
8. Display the number of followers you’ve got
The final way to integrate WordPress and Twitter is a great companion for your Feedburner chicklet – TwitterCounter.com is a free service that lets you add a Feedburner like number of followers to your WordPress sidebar – go to the site, sign up, copy the code and then paste it into your sidebar.php file. And you’re done!