Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

Version 1 Next »

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 stack.

Plugin boilerplate

  • In the root folder of the plugin we should find index.php and plugin-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 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 should be scrictly 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 the website with unecessary 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 for small projects like WordPress plugins and create unecessary 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 CSS.
  • In the root folder you will also find some configuration files for our different developement 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 of your project to prevent directory indexing if the server is misconfigured.

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 using get_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 should be scrictly 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 the website with unecessary 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 for small projects like WordPress themes and they create unecessary 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 CSS.
  • In the root folder you will also find some configuration files for our different developement 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 of your project to prevent directory indexing if the server is misconfigured.
  • No labels