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
- A WordPress plugin requires just one file (though there can be more). The file is called
- 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:
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.”
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.