Now that we have a working mockup, we can finally create our plugin. As before, we will start with a simple outline and then flesh it out. This time, however, we're going to introduce a new structure for our plugin and its related files, including several directories and PHP classes. Learning good organization and some object-oriented structures is an important step in your education as a developer.
We are choosing the name "Live Search" for our plugin, so our first step is to create a directory named live-search
inside the wp-content/plugins/
directory.
Inside that directory, we recommend the following items:
An
index.php
file which houses the Information Header for the pluginA directory for style sheets, named
css
A directory for images, named
images
A directory for included PHP files, named
includes
A directory for JavaScript files, named
js
A directory for tests, named
tests
You may not need all these directories for this plugin, but it is a useful structure.
Before we...