Plugin Considerations

When designing/writing software, or I suppose any kind of engineering for that matter, there is always a tension between features and complexity.  I really want this Simple Series WordPress plugin to be simple and easy to use.  But, as I use it more and more I find there are some possible features that I wouldn’t mind having.

For example, my DrawBot series is at 43 posts at this moment.  The problem is that each post, no matter how short, now has an entire screen-length’s worth of a list for the series. 1  Now, there are several possible ways to handle this:

  • I suppose when I’m looking to design a UI, the most important things to focus on is what would the user expect to see and happen.  It certainly makes sense for there to be a uniform series list in every post.  But, it seems slightly inelegant to have it that way for every single post when you’re looking at an entire page.
  • I could modify the plugin so that it would only create a list once per page, rather than once per post.  I suppose subsequent instances could then provide a single link to the series list in the initial post.  I think this would be non-intuitive as a person navigated the page.
  • I could modify the plugin so that it only showed the current post plus X posts before and after where X is some arbitrary number I choose.  (Although, I’d probably make it user specifiable).  I’d have to dig into some fancy scmancy CSS to define a different start-number for the HTML ordered list, but this isn’t a huge problem.  Ideally, it would say there are Y prior posts and Z subsequent posts as well.  Then again, it is really helpful (at least to me) to be able to click back up or down through a series list.

Perhaps the optimal result is something in between?

  • On a page consisting of a single post, the entire list should be displayed.
  • On a page consisting of multiple posts, the subsequent lists should be truncated in some meaningful fashion.  Perhaps the last and subsequent X posts, with a little sentence indicating Y more prior posts and Z more subsequent posts.  When you click on the “Y more prior posts” it could take you to the first instance of the series list on that page and when you click on the “Z more subsequent posts” it could take you to the next post listed in the series on the first instance of the series list on that page. 2
  • Sadly, this system would not really change much for the RSS feed readers.

  1. I can’t even imagine how much text is devoted to just the series list on those DrawBot posts in your RSS feed. []
  2. Um.  This sounded a lot clearer in my head as I typed it than it probably reads. []

Anti-Virals

Here’s the WordPress.org plugin download stats for “Simple Series with SEO!” for the first three days.

  1. 1/26/2012: 1 download1
  2. 1/27/2012: 99 downloads2
  3. 1/28/2012: 37 downloads3

It looks after being bumped from the newest plugins slot, the downloads dropped precipitously.  So much for going viral, money, and fame, eh?

Actually, I’m happy to have helped out a 100 people or so.  I also think a lot more people will end up using this plugin over time.  The alternatives, while very good, are more difficult to use and do tend to add a lot of other stuff into your WordPress installation.

  1. That was me installing it in another blog! []
  2. And a blog ain’t one []
  3. I have nothing clever to say about this. []

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. []
January 27, 2012 | Comments Closed

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.

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

My first published WordPress plugin! Simple Series!

This may seem silly, but I’m really happy with having published my very first plugin on WordPress.org.

My Simple Series plugin lets you easily create and helps you automatically maintain a list of posts.  I started writing this plugin because all of the existing ones seemed really clunky and over-engineered.  There’s no need for extra tables in WordPress, brand new taxonomies, or special system requirements.  If you can fire up any recent version of WordPress, you should be able to use this plugin without a problem. 1

As much of a WordPress fanboy as I am, I’ve never actually shared a plugin on the WordPress.org repository.  It was simultaneously easier and more difficult than I thought it would be.  The page that discusses how you can contribute your plugin and talks about “checking out” files makes absolutely no mention of how you’re supposed to do this!

Apparently you require a program to connect to the WordPress SVN to check out the file and commit changes.  On the advice of Schmarty I’m using TortoiseSVN.  Once that was installed and a sub-directory selected, it was relatively easy to commit changes.  If you haven’t tried it before, this whole SVN thing feels like a clunky slow version of FTP.

  1. Of course, now people are going to start e-mailing me with problems… []

Simple Series WordPress Plugin

I’ve written a new WordPress plugin specifically designed to let you simply and easily create a series of related posts.  You can download Simple Series here.

1. What does “Simple Series” do?

Simple Series uses a WordPress shortcode to associate your posts together.  All you have to do is use the same shortcode in all of the posts you want to associate together and the plugin does the rest.  It will automatically find all of the posts with the same shortcode, organize them by publication date, and put them together in a professional and easy to read format.  If you wish to change the format, you can just add your own custom CSS to your theme.

2. How does “Simple Series” work?

Easy!  Just add the shortcode to each of the posts you want to put in the series.  Inside the shortcode you will need to specify the title for the series.  Like so:

This Is My Series Title
  1. Simple Series WordPress Plugin

No problem!  The “Simple Series” plugin will always update the series lists in each of your posts whenever you publish a new post.  The newest post will always be added to the series in chronological order, by publication date.  You can see an example of what it looks like here in my own DrawBot series.

4. I have more questions!

Cool!  Please leave a comment to this post or send me an e-mail!

A nifty little WordPress plugin…

The idea for this little plugin has been rattling around in my head for a little while now.  It clocks in at less than 60 lines of code, including comments, and makes it easy to create a “series” for posts.

As I’ve been blogging about my (mis)adventures in building a DrawBot, I’ve been updating each post to contain a link back to all of the prior posts in the series.  However, if someone were to find one of the first posts – they wouldn’t see a link to a later post.  That is, unless I update all the posts.  That’s not really much of an option, since I’ve racked up 23 posts in less than 19 days. 12

This plugin is actually super simple.  Here’s what it does:

  1. Add a “post meta” tag for the current post with the same key as whatever you want to name the post series
  2. Query the database for all posts with the same post meta key as the one for the current post
  3. Output an ordered chronological list of all posts in with the same post meta key as the one for the current post

The simplicity of this plugin are actually some of it’s strongest features.  Unlike a lot of other series plugins out there, it doesn’t create any unnecessary tables in your WordPress database.  There are no settings to mess with, no CSS to fiddle with, no ugly standard formatting to overcome.

The only downside I can perceive is that if you delete the shortcode from a plugin, it will still leave the post-meta attached to the post and the post will still appear in the series.  If you leave the shortcode in and don’t specify a series title, it will delete the post-meta.  I suppose I could include a little button in the interface to delete the post from the series, but really, it’s just not going to be used that often.

Anyhow, this is something that I’ve wanted to have for a long time – I just hadn’t gotten around to building it yet.

  1. I’ve got a lot to say. []
  2. And, actually, that’s just 23 posts on this one topic.  I’ve probably blogged an equal amount over on the MakerBot blog, with a few totally random additional posts here. []
January 25, 2012 | Comments Closed

PayPal payments and micropayments

So, PayPal has a micropayment system as well as a regular payment system.  The micropayment fee is 5% + $0.05 while the normal fee is 2.9% + $0.30.  For payments below $12.00, it makes sense to use the micropayments system and the normal system above that level.

Here’s the rub – you can only set up your PayPal account for one or the other.  I’m working on a WordPress PayPal plugin, but I’d like to have that plugin work with micropayments without forcing all of my other PayPal transactions to go through that fee structure.  Oh well.

August 8, 2011 | Comments Closed

WordPress Plugin Writing Resources

WordPress is easily my favorite open source software project.  I love it for it’s functionality, flexibility, and extensibility.  When it comes to writing a plugin, these are my favorite resources.  Don’t write a plugin without them!

  1. WordPress.org Codex for Writing a Plugin
    1. If you’re just getting started, this is the place to begin
  2. WordPress.org Codex Plugin API
    1. a great overview of the WordPress plugin API
  3. WordPress Action Reference
    • When WordPress displays a post, page, or the administrative pages it has to run through a number of functions and actions.  Your plugin will need to be activated at one of these points, and it is very helpful to know the order in which things happen.
  4. WordPress Filter Reference
    • The WordPress filter reference is a list of WordPress filters.  Each one will be able to deliver a little piece of the website for your to manipulate in your plugins.
  5. WordPress PHP Cross-Reference
    • The WordPress codex is pretty good – but it is not comprehensive.  If you want to know how some of the more obscure functions, variables, or constants work, you’ll just need to dive into the source code itself.  PHPXRef is, hands down, the best way to do this.  It let’s you search and read the the source code from their website.
  6. Top 10 Most Common Coding Mistakes in WordPress Plugins
    • This is quite possibly the best blog post about writing WordPress plugins.  Applying these guidelines will make you a better WordPress developer and your plugins faster, more efficient, and more awesome. :)
  7. How to Design and Style Your WordPress Plugin Admin Panel
    • In a lot of ways, a program is only as good as its user interface.  Build a good friendly and powerful interface and people will use your program.  Build a bad one and no one will use it, no matter how awesome it is.  This one blog post gives numerous little ways to make your WordPress plugin administrative interface look better.
August 7, 2011 | Comments Closed

Thingiverse formatting plugin

Schmarty’s Thingiverse embed plugin is pretty sweet. I believe it has been updated so that calling the relevant shortcode looks much more like a Thingiverse link to a particular thing.

Since I’m in a procrastinating mood, I began to wonder if it would be possible to make this plugin even easier to use. There are probably a lot more efficient ways to do this, but it is easy to turn a list of Thingiverse thing links into a set of Thingiverse Embed shortcodes.

http://www. -> ""
.com/  -> " "
:  -> =
\r\n  -> ]\r\n[

I suppose all of this over-engineering is really only suited to me and probably would never save more time than it would take to actually just type out the links like any normal person.

May 26, 2011 | Comments Closed