Introduction
In order to make it a lot easier to get started creating your next MainWP Add-on, we have created the MainWP Development Add-on, which provides a basic “framework” to get you started.
Most plugin developers are going to want to create separate files for specific sections of their code in order to keep things a bit more organized & make it much easier to use and find the methods that you are looking for from other areas within your application.
Each MainWP Add-on contains the following files and folders that are based on the typical WP Plugin Structure with a few customizations in order to have the new extension show in the correct places.
This documentation goes over the MainWP Development Add-on “framework” & its structure.
For a more in-depth example on how to extend this “starter” extension, you will want to reference the article How to Create a MainWP Add-on to get a better understanding of how to work with MainWP & create something functional.
Extension Structure
The Main Add-on File (we will be referring to this as the MainWP “bootstrap” file from here on out)
mainwp-development-extension.php (MainWP “bootstrap” file)
In order for the MainWP “bootstrap” file to auto-include all of the classes within the /class folder, you must prepend this string “class-mainwp-“ to the beginning of all files within this directory like so:
`class-mainwp-{development}-{file}.php ( “development” & “file” may be anything )
The “bootstrap” file will then be able to find these files and include them as needed for the add-on. We include a few starter files that may be used if needed to build your custom add-on, such as
/class/ – All custom code will go in this folder
class-mainwp-development-admin.php – Main Admin Class
class-mainwp-development-ajax.php – Ajax & Sync Modal Handler
class-mainwp-development-db.php – Database Management Code
class-mainwp-development-individual.php – Individual Sites Management Tab
class-mainwp-development-overview.php – Add-ons Overview Page Code
class-mainwp-development-utility.php – Reusable Utility Code
class-mainwp-development-widget.php – MainWP Widgets Class
/css/ – All CSS files go here
mainwp-development-extension.css – Contains all CSS code
/js/ – All JS files go here
mainwp-development-extension.js – Contains all JS code
/languages/ – All language files go here