After looking over the examples on Digg.com
and trying out our own proof of concept, we know what we're aiming for, so let's think through the structure of the PHP code that is required. When you write your own plugins, it's a great habit to sketch an outline of the main components before you start any serious coding because it will force you to identify problems and establish a structure. Keep in mind there are many different ways in which a plugin could be written, so don't be discouraged if your outline differs from ours.
We know our plugin needs an information header and either the add_action()
or the add_filter()
functions. We also want to test the WordPress version in use and we're going to outline some of the helper functions we expect we'll need to achieve all of this. To help organize our thoughts, we are going to sketch an outline for our plugin by creating some PHP comments in the file that will become our plugin. Our plugin will slowly become functional...