What was I thinking

Time is the fire in which we burn

Time is the fire in which we burn

I’ve got this website I’m working on and I’m trying to launch a new product. 1 The last time I launched something there I built a quick hacky WordPress plugin using PayPal to serve up the product once a person had made an electronic payment.  Not only was it hacky, but looking back almost 2.5 years at that code I want to cringe.

Here’s part of the problem.  I hate PayPal so much.  They have ugly payment buttons, all the buttons are branded PayPal – which is a mixed blessing2 , unless you have a merchant account your users have to go through PayPal’s payment screens on their site – which causes users no end of angst, the user has to sign up for a PayPal account – which is a whole new layer of tech support nightmares when dealing with the technologically challenged, and I could go on.

I figured I’d give Stripe a shot, it’s supposed to be developer friendly.  After wrestling with it for two hours I’m giving up.  It’s not that it’s bad, it’s that I’m tired and I’m just not getting it and it’s easier to think like myself-as-a-crappier-coder-two-and-a-half-years-ago and fix up what I’d written than it would be to learn Stripe and shoehorn new code into my old code.

Some days I just want to tear down that website and start from scratch.  I just don’t have the time.

On a completely unrelated note, I’m loving this new CompFight WordPress plugin.  I’m extra happy about it since I contributed a quick one-line fix that helped improve the plugin.  This one little plugin is going to basically make it about 100 times more likely I’m going to be able to drop a fun image into my posts.  CompFight is a website that streamlines searching for Flickr CC licensed images.  I was actually toying with the idea of making such a plugin when I found out they just developed their own.  Awesome.

  1. Photo Credit: Riccardo Cuppini via Compfight []
  2. Good:  People know and trust PayPal.  Bad:  It’s freaking PayPal and kinda looks hokey. []

Articles on writing WordPress Plugins

Looking back at one’s code from years prior is like looking back at a junior high school picture of one’s self.  I’m looking back at the code for my quick-and-dirty pie chart plugin and think, man, why did I write things THAT way?

In the 1,000 years since I wrote that plugin in 2009, I’ve been trying to learn and comply with best programming practices for WordPress plugins.  As a result my current plugins tend to be stripped down, simple, don’t create unnecessary options, don’t create unnecessary tables, taxonomies, special post types, or those kinds of things. 1  Learning some Object Oriented programming along the way has been super helpful.  By encapsulating your WordPress plugin code into a chunk of objected oriented programming, you reduce the likelihood that your plugins’ function and variable names will collide with those from WordPress or other potential plugins.

If you’re getting started or need to brush up on your WordPress plugin development skillz, you should definitely check out these awesome articles:2

I’d also recommend tinkering with jQuery and JSON, if you haven’t already. 3  I don’t know of any really good JSON tutorials, so if you do, please let me know so I can add it to this list.

  1. Admittedly, I’m not really shooting for super ambitious plugins either. []
  2. Mostly stolen from the WordPress Codex! []
  3. I only use JSON for passing data from the browser to the server via AJAX and then decoding into a PHP object. []

Simple Series with SEO! after just one day

I’m really happy to report that per the WordPress.org stats, this little post series plugin has been downloaded more than 100 times so far.  That’s really awesome.  And, now that I’ve figured out how to work this wacky SVN thing, I think it would be fun to release some of the other random little plugins I’ve developed over the last few years.

As of the latest version 1.4, the plugin is now easy to modify with some CSS added to your stylesheet.  I could have added this as a text field option a settings page for the plugin, but I really like the stripped down simplicity of the plugin as is.  Even with all the comment lines in the plugin, it is only 53 lines of code.  If super short code were a goal1 I could probably cut that in half.2

Now I have to find some of my old plugins that others might find useful.  I’ve got one for frame escaping, one for making pie charts…  I know there are a few other random ones as well.

Default Series Title
  1. And it isn’t []
  2. Obviously, I’m not going to do this since it would make the code next to illegible []

100% Chance of AWESOME

I rather enjoy writing WordPress plugins.  It started writing them out of necessity, but I’ve ended up writing several for frivolous reasons and fun.  One of my favorites is based upon the hard work of Rasmus.  Basically, it turns

[wordpress_shortcode data=’Totally awesome=99|Merely awesome=1‘]

into

[pdrpiechart data=”Totally awesome=99|Merely awesome=1″]

Which translates, as the title would suggest, into a 100% chance of awesome.

I dusted off this plugin (probably written about a year ago) because of the numbers associated with the MakerBot poll I recently ran.  I find it very helpful to view such data graphically.  Hopefully you will too.