Twitters for 2010-05-13

Powered by Twitter Tools

Twitters for 2010-05-12

Powered by Twitter Tools

Twitters for 2010-05-08

Powered by Twitter Tools

Post-Mortem: Writing a WordPress Plugin

Very happy to say I’ve just released the first WordPress plugin I coded start to finish by myself (albeit standing on the shoulders of those who came before), Kachingle Medallion for WordPress. As the name suggests, the plugin simplifies using Kachingle on self-hosted WordPress blogs. You can see an example of the result on the right side of this page.

Of course we hope this plugin will speed adoption of Kachingle and be the first of several platform plugins we can offer.

Most of the process is reasonably well documented and straightforward. As with many open source projects, WordPress plugin development documentation is a bit of a mess and disjointed; for example, the page explaining how to have options for a plugin covers the older version info first and only after one’s read through that will you get to a heading saying info for newer versions starts here. Some important info, like using a single serialized option store versus one row in the options table per option, is not explained at all and the one decent linked external article didn’t explain it so I understood.

One difficulty I had was dealing with a boolean option, which I wanted to control through a checkbox on the options page. None of the docs I found dealt with this at all but fortunately I could look at the code of another plugin. Basically I wrote a custom validator that gets called on update which tests the value submitted by the form and if the value is “on” I return true.

The submission process is weaker. You go to a form that asks for a title, description and URL and no explanation of those fields or how they’ll be used. Nor can your submission be edited afterwords. There’s a README validator tool but the Markdown it expects is NOT the Markdown on John Gruber’s official Markdown page and the differences are nowhere explained.

I will try to get some time soon to go in and rectify some of these shortcomings, that’s what one does in open source projects after all.

Some important notes I want to pass along:

  • Wrap all your visible strings in either __() or _e() functions so later on localizations are easier.
  • Use define() to set up constants for names and default values of your options, and do define default values even if they’re empty strings or 0.
  • Be a good team player and hook the uninstall filter, where you can unregister your settings to clean up the options table.
  • If your plugin inserts content, decide what combination of widget, custom template tag and shortcode will be the best way to surface your content; for this plugin I wrote all three–but I refactored the code so all three call a single function that builds the content to display.

WordPress has greatly improved the tools available for plugin developers over the last few years. Recently for instance they added functions to much more easily include JavaScript and CSS files on both the public-facing and admin pages. And the community is very active and responsive.

Love to hear your comments on the Kachingle Medallion plugin!

Twitters for 2010-05-05

Powered by Twitter Tools

A Seven of Sevens

“There has been a strong favour for the number Seven, from a remote period in the world’s history. But a sort of mystical goodness or power has attached itself to the number in many other ways. Seven wise men, seven champions of Christendom, seven sleepers, seven-league boots, seven churches, seven ages of man, seven hills, seven senses, seven planets, seven metals, seven sisters, seven stars, seven wonders of the world,—all have had their day of favour.” From The Book of Days

Today is the seventh squared anniversary of my entrance on the stage of life. Not typically a major milestone but perhaps all the remarks about the big one coming next year have had me a bit thoughtful the last few days.

I’m luckier than most, no doubt, so don’t think I’m crying in my beer or anything. I have a beautiful, loving wife, terrific parents and sister, an affectionate little puppy and some good friends. We have a fine house in a quite neighborhood in a town we enjoy.

Still… I look at my Twitter feed and see a school friend, whose current novel debuted at #1 on the NY Times Bestseller list, in a picture with Jack Nicholson and the governor of New Jersey (who was a year or so behind me at high school). Another classmate is now the chief economist at the Treasury Department and a tenured professor at Princeton. Another has moved even further from our hometown than me, living in Shanghai the last eight years.

I haven’t written that great thriller screenplay or science fiction novel that’s been my ambition since I can remember. The time for my SaaS software idea has come and gone, it seems. Never bought the winning ticket for a $100 million lottery prize.

But hey, I’m not 50 yet. I’ve got plenty of time to do all of them and since I’m a lucky guy you know one of these days I will!

Twitters for 2010-05-04

Powered by Twitter Tools

Twitters for 2010-05-03

Powered by Twitter Tools

At WordCamp SF 2010

I had the pleasure of attending WordCamp SF 2010 with over 770 WordPeeps at the new Mission Bay Campus in San Francisco yesterday as I’m working on a WordPress plugin for Kachingle that will be available (very) soon (Tweets, Flickrs, more Flickrs).

Photo of Rinat Tuhvatshin of Kloop by Eva Blue Photo of Beau Lebens by tellyworth
Overall a good day:

  • My pal Beau Lebens gave a good lightning talk on Gravatar.
  • Matt Mullenweg, who is a terrific speaker, gave us an overview of the nearly-ready WP 3.0 (which this site already runs on) and the State of the Wordiverse.
  • Rinat Tuhvatshin, co-founder and executive director of the WPMU-based Kloop.kg portal (English), the largest blog hosting platform in Kyrgyzstan, gave an inspirational talk about how Kloop was the only serious news organization in the country to report on the initial actions in the recent uprising that overthrew the national government.
  • Richard Stallman is a passionate and thoughtful man but why he was given a major speaking slot at this event is a bit beyond me. Dude should get past the whole GNU ‘plus’ Linux thing already.
  • Niall Kennedy (VideoPress lead) and Joseph Scott gave separate but terrific presentations on WordPress plugins.

Quibbles: The lunch was kind of blah. I mean, no salad, just some nasty barbecued squash, no fruit and no tables to sit at while eating? And the parking was supposed to be $5 but I got charged $24–and getting out of the garage took over 10 minutes.

Question I did not get answered, though: When will WordPress.org get better search?

Twitters for 2010-05-02

Powered by Twitter Tools

Twitters for 2010-05-01

Powered by Twitter Tools

Twitters for 2010-04-30

Powered by Twitter Tools

Twitters for 2010-04-27

Powered by Twitter Tools