The BugEyed Review Blog

News, views and reviews by your average Joe on the street. No, my name is not Joe.

Planet inside WordPress

Posted by Bug-E on November 28th, 2005

I’ve been wanting to get a Planet aggregator page (See planetplanet.org) going for my blog for a while now, and whenever I had the urge to do so, I went and had a search for a WordPress plugin or some such to automatically update a WordPress page on my blog, with the Planet’s content, all with my current WordPress theme’s markups and doodats. Either I didn’t search properly, or there was no such thing…

As a short-term hack (long-term being figuring out how the WordPress plugin architecture works and getting a management interface going), I created a small shell script, together with the planetplanet.org app, to directly interface with the mysql database, and just update the WordPress page’s content.

You can see the end-result on my Bug-E’s Planet page.

The code can be found here. The shell script is the least of the effort though.

Installation instructions:

  • Follow the instructions at planetplanet.org to get planet installed
  • Follow their instructions to setup a config.ini file going, with all your rss feeds in the config file.
    I ended up with a single template, found here (right-click save as…), that had a very simple loop in.
  • Run the planet script once (python planet.py path/to/own/config.ini), making sure that it fetches everything fine, and creates all the output files you expect it to.
  • Open your WordPress admin interface, and create a new page (not a post, a page). Give it a name, leave it blank. Take note of it’s ID. You may need to have a look inside your database what that page’s ID is.
  • Download my planet2wordpress.sh script above, save it someplace
  • Open the script in an editor, and edit the first 8 config lines, filling in your database details, and some path details.
  • Important: Make a backup of your database first, use mysqldump or something, just in case something bad happens.
  • Run the planet2wordpress.sh script manually, like so:
    sh planet2wordpress.sh /path/to/wordpress.template.output.html
  • If there were no error messages, all should have worked fine, and you should see your planet’s contents on your blog page.
  • All that is left to do now is to play with the planet template file to make it look correct, this part took me the longest.
  • Once you’ve got the template all finished, just add the planet2wordpress.sh into your crontab, for every 15 minutes or however often, and voila, you have an automatically updating Planet page.

I hope this helps anybody that’s been wanting to do this. It helps me. :-)

Tags: , , ,