This code serves as a starting point for building a WordPress plugin using React and the block editor components. I also wanted to build WordPress plugins in a more modern PHP way by introducing a portion of the Service Container and Service Providers that are used in the Laravel framework.
Clone this repository or click Use this template on to create a new project on GitHub.
git clone https://github.com/jrtashjian/pluginwp.git yourpluginslug
Search for PluginWP Author
and replace with Actual Author Name
find . -type f -not -path "./.git/*" -exec sed -i 's/PluginWP Author/Actual Author Name/g' {} +
Search for PluginWP
and replace with YourPluginSlug
find . -type f -not -path "./.git/*" -exec sed -i 's/PluginWP/YourPluginSlug/g' {} +
Search for pluginwp
and replace with yourpluginslug
find . -type f -not -path "./.git/*" -exec sed -i 's/pluginwp/yourpluginslug/g' {} +
Finally, rename the main plugin file pluginwp.php
to yourpluginslug.php
.
Install the necessary Node.js and Composer dependencies:
$ composer install
$ npm install
composer lint
: checks all PHP files for syntax errors.composer format
: fixes all automatically fixable syntax errors.npm run wp-env
: exposes all commands available in@wordpress/env
npm run build
: compiles all scripts and styles for distribution.npm run dev
: compiles all scripts and styles for development.
Now go build something!