Here is my first article from a series : Write your own plugin for Wordpress.
How does plugins work
A plugin is basically a php file included within Wordpress at startup and plugged into the core. When I say file, it can be a set of files, but only one will permit recognition by Wordpress by using a specific header.
The fact that active plugins are included at startup forces developers to name their functions with unique identifiers. Some developers therefore prefer to use classes.
Where to start
I’d say that the first step is not necessarily to read the documentation. Indeed, before to code anything, you should define what you expect from your plugin, where data will be stored. Data storage can be limited to options, and for that, Wordpress has great facilities, but you may also need to use a database. In that particular case, you have multiple choices:
- Use the database using one or more tables
- Change the existing structure of the tables (be carefull when doing this, because Wordpress migration will be much more difficult)
Once this is done, you will have to write a White book, or a simple Roadmap can do the job. Let’s face it, some functions will take you so much time to developp (modifying the rewrite_rules for example) that you can lose yourself and forget some things you needed in your plugin.
And finally, define what can be updated via options, and tables you will need. It’s just another development project.
Next to come : the Plugin skeleton.
Français
It‘s quite in here! Why not leave a response?