The joy and pain of WordPress

As you may not have noticed, I migrated my site to WordPress some time ago as I did not want to maintain the old piece of crap I wrote myself when I was "young" ;)

Today I want to tell you a story of the development of a plugin for WordPress.

As the title says, it's much about joy and pain and I think I should start with the pain :)

WordPress is written in PHP, so are the plugins for it. And PHP is REAL pain (but there is no decent blogging software for Django or Zope that would fit all my needs). It is especially pain when you work with Python every day. What the heck are those curly braces and dollar signs and "$this->"? That's just not the way Guido indented it ;)

Additionally my last contacts with PHP were some time back in 2008 when I hacked on SysCP, which today result in commits like this:

-        if (is_int($new_instance['max_items'])) $instance['max_items'] = $new_instance['max_items'];
  • if (ctype_digit($new_instance['max_items'])) $instance['max_items'] = $new_instance['max_items'];

But I have to admit that the WordPress API is pretty good. Not very well documented (the wiki pages at are sometimes outdated), so you have to read the source and google a bit, but when you found the needed sources, it's pretty straight forward.

My plan was to write a simple widget, displaying my Twitter and timelines. Yes, both together, not one widget per service. The reason for this is the fact that I mostly post via and the messages get synced over to Twitter and only the local replies and retweets/redents differ.

The basic WordPress widget would look like this (source:

class My_Widget extends WP_Widget {

    function My_Widget() {

        // widget actual processes


    function form($instance) {

        // outputs the options form on admin


    function update($new_instance, $old_instance) {

        // processes widget options to be saved


    function widget($args, $instance) {

        // outputs the content of the widget




One only has to modify the widget() function and here you go.

From some other Twitter plugin I knew that I only had to include rss.php and call fetch_rss(url) for every feed URL to get the timelines as an array via MagPie. But when looking at rss.php, you notice the deprecation message in the header, saying one should use SimplePie now. Some google later I knew that I had to include feed.php and call fetch_feed(url) to get a SimplePie object representing the feed contents. But SimplePie is even cooler: I can call fetch_feed(array(url1, url2)) and get a merged feed, containing both.

Now I added a duplicate filter to elliminate the messages posted to both, twitter AND and my widget was ready.

You can find the result on and soon on :)


[...] This post was mentioned on Twitter by Planet Debian, Bertromavich Reibold. Bertromavich Reibold said: The joy and pain of WordPress | As the title says, it's much about joy and pain and I think I should… [...]

Bernd Zeimetz wrote on 2010-09-03 07:27:

What about Zine? It is a really nice wordpress replacement, written in Python. Or just use ikiwiki ;-)

evgeni wrote on 2010-09-03 07:31:

Didn’t know about Zine… Is there a nice gallery plugin for it as NextGen is for WP? Does it auto-pingback, non-akismet spam-filter etc?

But anyways, WP is running fine now, so I prolly won’t try zine yet :)

Send your comments to and I will publish them here (if you want).