Site icon Treehouse Blog

How to Create an RSS-Enabled, Micro-Blog with Twitter

Have you ever wanted to create a simple multi-person blog, but didn’t want to bother setting up an entire WordPress installation? If so then we’ve got just the answer. By combining Twitter Search, Atom feeds, hash-tags and PHP, you can create an RSS-enabled, micro-blog using Twitter and be up and running in less than 10 minutes.

The new Think Vitamin news feed is powered this way, so let me show you how we built it.

Screenshot of the Think Vitamin news feed

Sign up for Twitter

First off, make sure you and the other blog contributors have Twitter accounts. It’s free and only takes two minutes to sign up.

Choose your Hash-Tag

The way you will post to the blog is by including a ‘hash-tag’ in your Twitter post. For example, we chose #thinkvitamin for the news feed. It can be anything, but make sure it’s not too common so you don’t pull in Tweets that are irrelevant (ie #strawberries or #obama). A great way to check is to search for potential hash-tags at and see how many times they’re used. The fewer the better.

Create Your Atom Feed

Head over to and type the following into the search bar:

#your-hash-tag from:user01 OR from:user02 OR from:user03

Replace ‘your-hash-tag’ with the hash-tag you’ve chosen, and ‘user01’, ‘user02’ and ‘user03’ with the Twitter usernames of the folks who have permission to contribute to the blog. You can include as many Twitter usernames as you like.

This will return results from user01 or user02 or user03 where the hash-tag ‘#your-hash-tag’ was used. Now copy the ‘Feed for this query’ link to your clipboard (you’ll need it later).

Output the Atom Feed as HTML

You can use PHP (or any language of your choice) to parse the feed and output it to a page as HTML. This is where you’ll need the feed URL you copied in the last step.

The file atom-html.php (download the source) outputs certain nodes of the Atom feed as list items in an unordered list. You can then style this list however you like. Here is an example of how to implement the code:


# The URL for the Atom feed from
$url = “

# Create object to hold data and display output
$atom_parser = new myAtomParser($url);

# Return string containing HTML. The argument for getOutput() is the
# number of items to display
$output = $atom_parser->getOutput(5);
echo $output;

Count the Subscribers with FeedBurner

It’s important to know how many subscribers you have, so make sure to pipe the Atom feed (that you created in the ‘Create Your Atom Feed’ above) through FeedBurner. If you don’t have an account, it’s free and easy to sign up.

Once you have a URL from FeedBurner for your feed, make sure to include it as the ‘Subscribe’ link in the HTML.

What About Comments?

We haven’t enabled any commenting on the Think Vitamin news feed, but this could be added by including a Disqus snippet in the HTML output.

That’s it.

We told you it was easy. Let us know if you’re currently using Twitter on any of your sites in an interesting way.

Exit mobile version