The following boilerplates are following WordPress industry standards best practices, conventions and tools. If you are not familiar with them please read our internal documentation on our WordPress developement development stack.
Plugin boilerplate
- In the root folder of the plugin we should find
index.php
andplugin-yourpluginname.php
which serves as the plugin init file. - All other PHP : must be located in
/inc/
, must follow WordPress coding style and coding standards and must should ideally be object oriented. - External libraries and dependencies should be loaded using composer and will be located in
/vendor/
. - All static files should be located in
/assets/
, properly named and placed in the correct folder (css/
,js/
,images/
,fonts/
, etc... ). - Inline CSS and Javascript JavaScript should be scrictly strictly limited to passing variables to scripts and stylesheets. All other JS/CSS code should be
/assets/js/
and/assets/css/
and properly enqueued. Try to enqueue scripts and styles as smartly as possible to prevent clutering cluttering the website with unecessary unnecessary resources. Ideally your assets should be minified,packed and mapped. - If a task runner is used (for linting or minification), npm-script should be used. While grunt and gulp are great tools, they are usually unecessary unnecessary for small projects like WordPress plugins and create unecessary unnecessary dependencies and points of failure.
- We do not use any CSS pre or post processor, they have created some hassles in th past so we have opted to work with pure While you can write pure CSS, we encourage your to use SASS to write modern and modular CSS.
- In the root folder you will also find some configuration files for our different developement development tools and the plugin README file.
.gitkeep
files are here only for documentation purpose and can be deleted in production.- Please follow our guidelines regarding PHPDocs in WordPress projects
- Make sure to have an empty
index.php
in each subfolder sub-folder of your project to prevent directory indexing if the server is misconfiguredmiss-configured.
Theme boilerplate
- In the root folder of the theme we should find
index.php
, style.css, functions.php as well as all our templates . php files. /template-parts/
contains re-usable template parts to be included usingget_template_part
and other WordPress native template helper functions./inc/
contains all other PHP files.- All our PHP files must follow WordPress coding style and coding standards and should be, when possible, object oriented (ie: Widgets, Metaboxes, ...).
- External libraries and dependencies should be loaded using Composer and will be located in
/vendor/
. - All static files should be located in
/assets/
, properly named and placed in the correct folder. - Inline CSS and Javascript JavaScript should be scrictly strictly limited to passing variables to scripts and stylesheets. All other JS/CSS code should be located in
/assets/js/
and/assets/css/
and properly enqueued. Try to enqueue scripts and styles as smartly as possible to prevent clutering cluttering the website with unecessary unnecessary resources. Ideally your assets should be minified, packed and mapped. - If a task runner is used (for linting or minification), npm-script should be used. While grunt, gulp, etc. are great tools, they are usually unecessary unnecessary for small projects like WordPress themes and they create unecessary unnecessary dependencies and points of failure.
- We do not use any CSS pre or post processor, they have created some hassles in th past so we have opted to work with pure While you can write pure CSS, we encourage your to use SASS to write modern and modular CSS.
- In the root folder you will also find some configuration files for our different developement development tools and the theme README file.
.gitkeep
files are here only for documentation purpose and can be deleted in production.- Please follow our guidelines regarding PHPDocs in WordPress projects
- Make sure to have an empty
index.php
in each subfolder sub-folder of your project to prevent directory indexing if the server is misconfiguredmiss-configured.