Each module contains a PHP file with the same directory name. All other module files are sorted by type in the /lib/ subfolder.
A minimal module requires at least the PHP file with the module class for initialization.
This directory contains all static CSS files.
The default.css exists only for modules for Gutenberg blocks. Here we save and, if necessary, change the default CSS of the Gutenberg blocks supplied by WordPress and the Gutenberg plugin.
The common.css contains the style information required by our theme in addition to the default.css.
In addition, there may be other CSS files in the folder, for example for parts of the module, in order to load them only if necessary.
CSS files for block styles always have the prefix style_.
If the CSS cache is active for a module, it is assumed that the default.css and common.css exist, even if they are empty. For performance reasons, there is no file_exists check.
This directory contains all dynamic CSS files.
The init.php contains one or more includes to make the PHP files easier to edit, for example for different elements of a module.
There is at least one general.php in which the actual CSS code is generated.
If the CSS cache is active for a module, it is assumed that the init.php exists, even if it is empty. For performance reasons, there is no file_exists check.
This directory contains all JS files for the backend, such as WP-Admin or the block editor.
The init.js and block_extra_styles.js are optional and are loaded as soon as the file exists and is not empty. If additional JS files are required, they must be registered and classified in the module.
The block_extra_styles.js registers Extra Styles for Gutenberg blocks.
The init.js loads in the backend, currently on the following admin pages:
- Setting pages of SV100 and straightvisions plugins
- Post Processing
- Category Editing
- Widget Editing
This directory contains all the JS files for the frontend.
Each front-end JS file must be registered and ranked so that it is loaded in the frontend.
If the module offers output in the frontend, the corresponding code is usually in the default .php.
As a rule, the output takes place on demand, i.e. only if the content for the currently accessed page is also required.
In template files themselves, no CSS or JS files are generally classified or embedded.
If settings and a section are defined for a module, a settings page is automatically generated.
The directory is therefore optional and is loaded only if the module calls the method set_section_template_path( ).
If the mentioned method is called in the module, the init.php is called in the settings directory, where an individual settings layout can be defined.
The init.php should not contain any settings itself, but forms a wrapper for the individual tabs that are included, starting with the general.php for the general module settings.
If necessary, additional optional subdirectories, such as /img/, may be available.