abhishek-pokhriyal / wp-plugin-boilerplate
A boilerplate to create WordPress plugin.
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 4
Type:wordpress-plugin
Requires
- php: ^7.2
This package is auto-updated.
Last update: 2025-06-09 14:36:28 UTC
README
A boilerplate to create WordPress plugin with rapid assets compilation using Grunt.
Prerequisites
- NPM
- Grunt
Installation & getting started
Via composer
-
In your plugin's (empty) root directory, create a
composer.json
file and paste the following contents in it.{ "require": { "composer/installers": "1.9.0", "abhishek-pokhriyal/wp-plugin-boilerplate": "^1.0" }, "extra": { "installer-paths": { "./" : ["abhishek-pokhriyal/wp-plugin-boilerplate"] } } }
-
Run
compser install
. This will put the boilerplate code in the plugin's root directory (it will also overwrite the contents ofcomposer.json
file created in the previous step.)
Manually
-
Clone the repository inside your
wp-content/plugins/
directory.git clone https://github.com/abhishek-pokhriyal/wp-plugin-boilerplate.git
-
Rename file and variable names according to your plugin name.
-
Find and replace the following names:
Sl No Find Replace 1 WP Plugin Boilerplate
My Plugin Name
2 wp-plugin-boilerplate
my-plugin-name
3 wp_plugin_boilerplate
my_plugin_name
4 WpPluginBoilerplate
MyPluginName
5 WPB_
MPN_
6 WPB()
MPN()
7 wpb-
mpn-
-
Rename files containing
wp-plugin-boilerplate
tomy-plugin-name
:Sl No Default file name Your custom file name 1 wp-plugin-boilerplate.php
my-plugin-name.php
2 class-wp-plugin-boilerplate.php
class-my-plugin-name.php
-
-
Follow Build steps for assets if any assets development/changes are involved.
-
If your plugin does not need Bootstrap, you can delete the
bootstrap
andutilities
directory from theassets/css
directory and remove all the import containing bootstrap fromstyle.scss
. -
Now, you're ready to get started for the development.
Build steps for assets
-
cd
into the plugin root directory -
Install node dependencies
npm install
-
Generate the compiled and minified files, run
grunt
-
Generate the compiled and minified files while development (as soon as you hit
CMD + S
), rungrunt watch
Plugin structure
+-- assets/
| +-- css/
| +-- bootstrap/
| +-- utilities/
| +-- js/
| +-- admin/
| +-- frontend/
|
+-- includes/
| +-- class-wp-plugin-boilerplate.php
|
+-- node_modules/
+-- .eslintignore
+-- .eslintrc.js
+-- .gitignore
+-- Gruntfile.js
+-- license.txt
+-- package-lock.json
+-- package.json
+-- README.md
+-- wp-plugin-boilerplate.php
License
WordPress Plugin BoilerPlate is released under the GPLv3