23 April 2008
Customizing TwitterRSS Plugin for Wordpress
Posted by Aditya under: Internet; Twitter; Wordpress .
As you might notice I now have my latest Twitter status on my main homepage. Those of you reading this on RSS feeds, feel free to click through and see.
Now this was possible thanks to the TwitterRSS plugin by Dave Kellam [via Patrix]. It is a very simple plugin and easily integrates Twitter with Wordpress. However, it doesn’t have enough material to explain how to customize it, although it is really quite simple.
So I thought, I’d share what I did to customize the look of my twitter status. If you go to the Plugin Editor in your Wordpress admin panel, and open the twitterrss.php file, you will see a segment of code like this:
function get_twitterRSS() {
$rss_url = 'http://twitter.com/statuses/user_timeline/14297652.rss';
$username = "adityar";
$num_items = 1;
$before = "<br/><center><h4><a href='http://twitter.com/adityar'>Twitter Status:</a><strong>";
$after = "</strong></h4></center><hr />";
$hide_links = "true";
$hide_username = "false";
Now “$rss_url” is the URL of the RSS feed of your Twitter status. “$username” is your Twitter username, in my case, ‘adityar’. “$num_items” is the number of tweets you want to display at a time. I wanted to display only one at a time, so I set it to 1.
What you might be mainly interested in is the “$before” and “$after”. These are the variables that will hold your HTML tags. So if you want to display your Twitter message in bold, you would set $before = “<strong>” and $after=”</strong>”. This way you can format your twitter status the way you want it.
Remember to hit update and refresh your site to see the changes. Ideally the developer may want to have a GUI to save people the trouble of having to update the plugin file. But it still is a very simple and lightweight plugin, nonetheless.
Hope that helps.
2 Comments so far...
Semantic Overload Says:
26 April 2008 at 3:42 am.
” <center> is an invalid w3c tag, you might want to change that to something else. I suggest putting your twitter status in its own div and use css to center the div.”
Aditya Says:
26 April 2008 at 3:46 am.
Semantic Overload
You are right. I am considering instead to enclose them in a <p align=’center’> I just wanted a temporary hack to get it working.
I might work on it later. Just feel a little too lazy at the moment. ![]()
