Today I learned:
Development planning for new developers
Philosophies like Agile Development are great for teams working on large projects, but for someone just getting started with development and working on small projects, they can be a little much. For situations like this, Readme Driven Development strikes the right balance of planning out your project, writing documentation, and actually doing the work.
Write your Readme first! (H/t to Eric Davis for telling me about this.)
Wordpress Plugin Basics
I have a food & drink website where I post regularly. Lately I’ve been trying lots of kinds of coffee to dial in my ROK Espresso maker and I’m starting to reach the limits of how many I can accurately remember. I’ve been wanting to make a Wordpress plugin for a while, so why not make a plugin that makes a Coffee Reviews custom post type? (The main goal here is to write my own plugin and learn how it is done, so please don’t suggest already made plugins that I could use.)
I’m using Wordpress’s Plugin Handbook to learn the basics.
The most basic Wordpress plugin is a PHP file with a plugin header comment. Here is mine:
You’ll eventually want a lot more in the header. Here are the requirements.
Hooks allow you to tap into Wordpress without editing the core files. (Rule #1 is to never edit the core files.) You pass functions through hooks to extend or change Wordpress functionality.
register_activation_hook() runs when you press “Activate” on a plugin. Since I’m making a custom post type, I’ll want to use the activation hook to refresh permalinks once the post type is created. If your plugin needs a custom database table, you can create that with a function passed to this hook.
register_deactivation_hook() is basically the reverse of the activation hook. When you deactivate the plugin, the items passed to this hook fire. I’ll want to clear the permalinks again.
I made a barebones plugin tonight that registers the custom post type. I definitely have more work to do, but saving, hitting refresh, and seeing this appear never gets old!