I Could Totally Do That

My first session at WordCamp NYC was Introduction to Plugin Development.

I’ve never written a WordPress plugin. I’ve never had an occasion to. But I thought knowing how to go about it might come in handy someday.

The kid in the front started the talk. He introduced himself and said he’d been writing plugins for “oh, about six months.”

Here’s what he covered:

  • A WordPress plugin needs it’s own directory in the wp-content/plugins directory.
  • A WordPress plugin requires just one file (though there can be more). The file is called nameofplugin.php.
  • The main plugin file (nameofplugin.php) needs to start with the following comment to tell WordPress about the plugin:
<?php
/**
 * Plugin Name: Name Of The Plugin
 * Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
 * Description: A brief description of the Plugin.
 * Version: The Plugin's Version Number, e.g.: 1.0
 * Author: Name Of The Plugin Author
 * Author URI: http://URI_Of_The_Plugin_Author
 * License: A "Slug" license name e.g. GPL2
 */
  • Plugins add or modify functionality by using WordPress hooks, and the most common ones are:
    •  add_action(), and
    •  add_filter()

Ok. I thought. When’s he going to get to the good stuff?

But then, that was it. He stopped there.

Someone asked how you know which hook to use.

He said, “WordPress has thousands of hooks, so it depends on what you want to do.”

Ok.

Nothing against the kid. I’m pretty sure it was his first time getting up in front of people at one of these things. And he did ok for what it was. If I’d been starting from zero, I probably would have gotten more out of it.

But I could have given that talk.

Someday, in the not-too-distant future, I probably will be giving that talk.

When I do, I’ll let you know.