Daily Archives: Sunday, 14th Oct 2007

List Draft Posts: a WordPress plugin

As of March 2011, I am officially abandoning development of this plugin – anyone who wants to adapt it to do something more, something different, or indeed to write a version that won’t make real coders cry, is more than welcome to do so. There will be an update of the widget version soon, though.

Quite some time ago, I revealed to the world my first attempt at a WordPress plugin: Coming Soon. This was a very basic thing that just listed the titles of all draft posts. This is the sort of thing that’s of little or no interest to most WordPress users, but I like to have it in my sidebar to tease readers with hints of things to come, and to remind me of things I need to get on with writing.

The first version had everything hard coded – if anyone wanted to use it for their own purposes, they’d have had to edit the PHP, which was a bit messy. A later version actually used parameters for the function, which would have made things a little easier, but still wasn’t that friendly. But as I was the only one using it, this didn’t seem all that important.

But on Friday evening, I was looking at the WordPress Support Forums when I saw someone asking for advice on developing plugins, which led me to this really nice article by Leonid Mamchenkov on how to make options pages for WordPress plugins, and this piece by Mark Jaquith on how to make such things more secure[1].

And so I started fiddling. And, err, several hours later, I had a new version of my plugin, which has an options page for setting the title for the section, the text used for untitled posts and the HTML tags that surround it all. By default, the plugin’s output is set to be an item in an unordered list. The heading is a <h2>, and the titles form an unordered list. That should work for the sidebar in most WordPress themes, but if it needed to be in a <div>, or some other formatting, then changing it is now a simple matter of changing the options.

As it’s pretty much a new plugin, I decided to rename it to the rather more descriptive List Draft Posts, and changed the function name to match.

Download

If this looks like something you would like to use, you can download it from the official WordPress Plugins Directory. Woo.

Installation

Unzip and upload the lcb_list_draft_posts.php to your WordPress plugins folder. Activate the plugin in the usual way, then look at the List Draft Posts page under Options. Unless you have special requirements, you will probably only need to change the Heading and Description for untitled drafts options. Click the Update options button to save your changes.

Usage

Include the following code at a suitable point in your sidebar:

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

Create a new post, save it without publishing and you should see a list in your sidebar. If there are no draft posts, nothing should appear.

Widgets?

Time passes, and all that. I have since created a widget version of this plugin.

Problems?

Add a comment to this post, and I’ll look into it as soon as I can. I should mention that I’m not really a coder, so this plugin may not be doing things in the best or most efficient manner, and may drink all your wine or eat your chocolate when you’re not looking. This version has only been tested on WordPress 2.3, but it should play nicely with anything above WordPress 2.0.x.

Conclusion

Until now, I hadn’t realised just how nifty WordPress’s system for allowing plugins to add themselves into the admin interface was. Using the instructions I mentioned earlier, a non-coding person like me was able to make it work with only a few mistakes along the way. Of course, writing more complicated and useful plugins is another matter altogether, and is best left to people who actually know what they’re doing.

[1] Note to UK readers: this article uses a slightly unfortunate expression for a number used once. This has caused some amusement. It’s that thingy about two countries separated by a common language again…

Rufus Wainwright at the Sage Gateshead, 2007

Last night, I went to the Sage to see Rufus Wainwright on the first date of his UK tour. It was the third time I’d seen him, and as always he put on a great show.

Even though I booked fairly early, the best seat I could get was in the last but one row of the highest level of Hall One at the Sage, but at least I was right in the middle of the row. The seats are raked very steeply, and staggered, so the only way you could fail to have a perfect (if slightly distant) view of the stage is for a giraffe to be sitting two rows in front of you. And the sound was absolutely perfect, as expected in a venue designed to be a world-class concert venue. The only drawback was the lack of legroom, which meant my poor old knees grumbled a lot for much of the show.

After a rather good opening set from singer-songwriter Scott Matthews, whose work I’ll have to investigate further, Rufus’s band took the stage at around 8:30. The lights were low, so it wasn’t possible to see who was who. Someone was sitting at the piano – was it Rufus in a hat? Well, no. Once everyone was in place, the man himself came on, in a very white suit covered in glittery brooches.

The show was dominated by songs from the current album, Release the Stars, and what a fine collection of songs they are. After the first fifty minutes or so, there was a twenty minute interval, after which Rufus returned wearing what appeared to be Sound of Music style Lederhosen. I could be wrong, as he was a bit distant. The long white socks suited him, anyway…

More music followed, with a total on-stage time of around two hours, which was enough to entertain everyone and leave us all wanting more – now that he’s got five albums to choose from, there’s no way he can play everything that everyone wants to hear, but he did play some of my favourites – The Art Teacher being a good example.

As always, the show was a mixture of the full band, Rufus playing solo on the piano, and smaller parts of the band. And the band deserve a mention – along with the usual guitar, bass (electric and big upright string thingy) and drums, Rufus brought along his outrageously talented horn section – guys who between them played more instruments than seems decent. And at one point, drummer Matt Johnson took over bass playing duties.

Other highlights included the traditional over-the-top costume routine for the encore. The second set ended with 14th Street. Rufus left the stage first, with the band leaving one by one, in an obvious ploy to give Rufus time to change…

So, back he came in a white dressing gown and at down at the piano for a few old favourites, including I don’t know what it is. Then came the fun bit…

Off came the dressing gown, revealing a Cabaret-style outfit: dinner jacket, top hat, fishnets and heels. The band came back on dressed in dark suits and managed a creditable dance routine to Rufus’s performance of Get Happy. The music was on backing tape, as the band were otherwise occupied, and I don’t honestly know if Rufus was miming or using a radio mike, but it doesn’t really matter – it was a great performance, and possibly the best show closer I’ve seen him do yet. After that, the band returned to their instruments, and Rufus closed the show with Gay Messiah. And that was that.

Lots more comments, set lists and details can be found on the relevant section of the Rufus Wainwright Message Board.

Sunday status report

Well, it’s now been two weeks since I started trying to do something about my weight[1], so it’s a good time to check on my progress. As of today, I’m just over two pounds lighter than I was when I started, which is a good start.

Taking a longer view, I’m currently around four pounds heavier than I was at the start of the year, which gives me my next target. I want to get firmly below 15½ stone (217 pounds or 98.4kg) by mid-November. Then, I’d like to continue to lose about one pound each week for as long as I can.

On the exercise front, I’m not going to get too ambitious – I’ll stick with walking to and from work as much as possible, and see how that goes.

More updates will follow. Probably.

[1] Again

Robin Hood – The Booby and the Beast

The second episode of the new series managed to stay on the fun side of silly without actually crossing the line and being too stupid to tolerate. It’s a fine line, and some people may draw it in a different place than I do, but this is my site, so it’s my line that counts. So there :tongue:

Following on from last week’s revelation that the Sheriff is plotting with the Black Knights, a gang of other dodgy characters, to kill King Richard when he returns to England, Robin has found out that all the tax money is being kept in a secret strongroom in the castle. And so the gang turn up and try to rob it. This turns out to be a wee bit tricky, as the room has a nice selection of booby traps of the kind that Indiana Jones would recognise. Temporarily defeated by the arrows, automatic gate and the like, the gang leave to plan their next step.

While Guy, err, rewards the men who built the strongroom in the traditional manner involving the pointy end of a sword or two, the Sheriff gets on with his next Evil Plan. He’s invited Count Friedrich, a German nobleman, to Nottingham to gamble in his, err, casino. Friedrich appears to be a buffoon, played by Dexter Fletcher with an alarming range of accents and more than a slight touch of campness. The Sheriff “persuades” Marian to look after Friedrich and generally distract him.

And while that’s going on, Robin and the gang meet Stephen, the man whose designs were borrowed for the Sheriff’s strongroom.

And so it goes. Lots of the usual silliness follows, with Friedrich proving to be more than he seems, the strongroom being not quite what it seems either, and everyone happy at the end. Well, everyone except the Sheriff and Guy, but we don’t really care about them, so that’s quite in order. And the rest of the Black Knights are due for a little disappointment, too.

It is, of course, complete rubbish. It makes no sense historically, not that much sense as legend, and most of Robin’s gang look far too clean and pretty to be even vaguely believable. But it’s all done with a nicely light touch, and above all, it’s fun.