Plugin boilerplate for WordPress plugin developers.
This boilerplate is based on Wordpress Create Block and Clean Architecture
It supports block development with React, ESNext, and JSX compilation.
Especially for developers who want to create a plugin with clean architecture and clean code.
It is not useful for simple and small projects.
You can use this boilerplate for large projects includes multiple post types, custom fields, custom taxonomies and more.
If you need a simple plugin, you can use [Light Wp Plugin Boilerplate]
The Boilerplate can be installed directly into your plugins folder.
Then follow these steps:
-
change
plugin_name
toexample_me
-
change
plugin-name
toexample-me
-
change
Plugin_Name
toExample_Me
-
change
PLUGIN_NAME
toEXAMPLE_ME
-
change
pluginName
toexampleMe
-
change
plugin.php
toexample-me.php
-
Install composer dependencies
composer update
-
Install dependencies
npm i
-
Update packages
npm run packages-update
-
Start plugin
npm start
-
Build for production
npm build
The boilerplate use "/src" folder to create blocks (via @wordpress-scripts package). There is a sample block in "src" folder. You can modify this ore create another custom block.
To register a block:
- Build your blocks with the "npm run build" command (Make sure your current root is equal to the root of the plugin in the terminal) This command builds all blocks in "src" folder.
- Go to "inc/class-plugin-name-blocks.php"
- Register your blocks in the register_plugin_name_blocks() method via the register_block_type() function. To learn more about the Register_block_type() function, visit https://developer.wordpress.org/reference/functions/register_block_type/)
If you want to watch changes in your block you can use 'npm start' command and see the changes immediately.
The WordPress Block Plugin Boilerplate uses a variable to store the text domain used when internationalizing strings throughout the Boilerplate. To take advantage of this method, there are tools that are recommended for providing correct, translatable files:
Any of the above tools should provide you with the proper tooling to internationalize the plugin.
The WordPress Block Plugin Boilerplate is licensed under the GPL v2 or later.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
A copy of the license is included in the root of the plugin’s directory. The file is named LICENSE
.
The WordPress Block Plugin Boilerplate is licensed under the GPL v2 or later; however, if you opt to use third-party code that is not compatible with v2, then you may need to switch to using code that is GPL v3 compatible.
For reference, here's a discussion that covers the Apache 2.0 License used by Bootstrap.
Created by Kadim Gültekin