Daily Archives: Sunday, 29th Jun 2008

List Drafts Widget

Updated, March 2010: Advance warning: I’ve finally got round to redoing this widget using the Widget API introduced in WordPress 2.8. Thought I’d better do it before a WordPress update breaks it. There will be an update here and probably a new post when the new version is available.

A long time ago[1], I unleashed on the world my first (and so far only) WordPress plugin: List Draft Posts. It’s a simple thing that lists the titles of any posts that you’ve started on but not yet posted. Simple is the only kind of coding I can generally manage, so it’s stayed simple, the only bit of sophistication being a form to control the layout it uses[2]. But it works for me, and it’s possible that one or two of the 239 people who’ve downloaded it from the WordPress plugin repository might be using it[3].

But it did lack one thing: it couldn’t be used as a WordPress widget. Well, there are ways of using a special widget to run a plugin’s function, but that’s not the same thing, is it? Having started to move my site to widgets, I decided to learn how to turn my own simple plugin into a widget, and started searching.

And that was a bit tricky at first. Some documentation I found assumed rather too much in the way of coding knowledge, and missed out some details that would be needed if you actually wanted your widget to work. But after a while, I found a post by Kaf: My Widget – example WordPress Widget. This, together with some changes suggested in the comments enabled me to get to work. After a lot of fiddling, tweaking, head-scratching, editing, re-editing and muttering, I managed to create a new version of List Draft Posts that is entirely widgety. Someone who knows how to code could probably make a version that would work as either a plugin or a widget, but for now I’m going to leave it as two separate versions.

As a standard widget, it doesn’t need much configuration – you can enter a heading to go above the list of posts, and a description for any draft posts that don’t have titles. It outputs its stuff in an unordered list below the heading:

<li>A post I need to finish</li>
<li>Another post I've started</li>

I’m going to play with it a bit more, make sure it doesn’t break anything, then submit it to the repository. If anyone desperately wants it before then, leave a comment, and I’ll make it available by some means or other.

Update: You can now get the widget from the official repository: List Drafts Widget

[1] In internet time
[2] And that lacks a lot of sophistication itself
[3] Hi guys :wave:


A few years back, the WordPress developers introduced a little feature called widgets. The idea is to make it easier to have various stuff[1] in your sidebar. Without widgets, instead of editing sidebar.php in your theme folder, and typing in loads of code, being careful to use calls like this:

<?php if (function_exists('some_function'))  some_function(); ?>

if you want to use a plugin function[2], and otherwise typing in lots of HTML, PHP, and possibly JS and QZ[3].

Widgets save you doing all of that. WordPress comes with built in ones, themes can include their own (in the functions.php) file, and plugins can add plenty more. There’s an almost easy to use interface to add and configure them[4], and you can rearrange your widgets to be higher or lower on your sidebar (or sidebars if you have two).

But being the kind of geek I am, with my own ingrained habits, I’d never got round to moving Losing it[1] to use widgets. Until today, that is. The sidebar is now all done with widgets. Some bits were done with plugins I was already using (the random pictures and the LastFM music thingies), others are just text widgets (you can have a widget containing any text and HTML you like, more or less), one involved making a change to the theme’s functions.php file (I wanted the little icons for the RSS Feeds bit), and one was a major effort, but I’ll talk about that in a separate post.

Anyway, it all appears to work, and it’ll be easier to rearrange the sidebar or to add or remove bits in future. Cool. I really should get round to these things a bit quicker, but I never seem to find the tuits…

[1] Technical expression :cheesy:
[2] Failure to do so can result in lots of mess if you deactivate a plugin…
[3] I may have invented one of those
[4] Its implementation in WordPress 2.5 is a little more awkward than it might be, but it is usable

Fluency Admin for WordPress 2.5

I’ve done a fair amount of muttering, moaning and general wittering about the changed user interface in WordPress 2.5, but since I managed to mitigate most of the annoyance with some handy plugins, I’ve been able to get on and use it without too much frustration.

My recent redesign and subsequent tweakage involved me removing a number of plugins that I’d been using for quite a long time, even one I’d spent some time persuading to play nicely with WordPress 2.5. Combine that with a recent incident of someone managing to fool my anti-spam plugins and get a load of silly comments on one of my posts, I decided it was time to have a general overhaul of which plugins I use.

I’ve switched spam protection from the combination of Bad Behavior and Spam Karma to the ubiquitous Akismet, removed some other bits and pieces that I haven’t actually been using, and then turned my attention to the admin interface.

I’d seen references to the Fluency Admin plugin, but hadn’t really looked at it properly. This morning, I decided to give it a try. It installs like any other WordPress plugin, and immediately transforms the admin interface into something quite nice.



It covers the functions of the plugins I was using to remove the nasty narrowness and excessive height of the Write page, works with the drop-down menus from Ozh’s plugin, and changes the pastel blues to a grey palette. So far, I like it. Interestingly, there’s a test version of WordPress around that uses some similar ideas for navigation (though it doesn’t look as pleasing to my eye).

Details on the plugin page, and screenshots on Flickr.


No, not the good Doctor, but an, err, interesting version of The Who’s Baba O’Reilly, played with Windows sound files. I was alerted to this by the link of the day feed from User Friendly, where the dreaded phrase “too much time on his hands” was used. I’ve never really understood that. Why do people say that about people who do something creative, if pointless? You don’t generally hear it about people watching TV, or going to sports events, or randomly shopping, so why do people say it about people who actually do something themselves? Anyway, here it is. Enjoy, or at least endure it. :cheesy: