Another important step to a professional plugin is maintaining a clean folder structure, which pertains to keeping all similar fi les together. For example, if your plugin requires JavaScript fi les, create a /js folder and store all the JavaScript fi les in this directory. If you have custom style sheet fi les, create a /css folder to store all your CSS fi les. Keep all images stored in a /images folder.
Now look at a standard folder structure for a plugin:
- /unique - plugin - name — (no spaces or special characters)
- unique - plugin - name.php — Primary plugin PHP file
- uninstall.php — The uninstall fi le for your plugin
- /js — Folder for JavaScript files
- /css — Folder for stylesheet files
- /includes — Folder for other PHP includes
- /images — Folder for plugin images
As you can see, keeping your fi les organized using a clean folder structure can make it much easier to track the fl ow of your plugin over time. It can also make it much easier for other plugin developers to follow your logic when they view your plugin ’ s source code.
REFERENCE:
Brad Williams, Ozh Richard and Justin Tadlock. 2011. Professional WordPress Plugin Development. Indianapolis: Wiley Publishing,inc.