Typical workflow

Let’s see a typical workflow in order to develop a WordPress Plugin.

Start your Vagrant / Valet environment

Before starting, you have to prepare your developing and testing environment. To do this, you can use a Vagrant WordPress or the Valet solution. We call this environment WordPress Host.

Client Host

If you are on Mac, Window or Linux, I’ll assume you have access to WordPress Host plugins folder by your Client Host.

Using the WP Kirk template

On GitHub, you can create a new repository using the WP Kirk Boilerplate by clicking on the “Use this template” button on the repository page.

Create a new plugin from template

Clone the WP Kirk repository

You may also clone the repository using either the Git command line or the Github for Mac application.

Change directory to the wp-content/plugins folder of your local WordPress installation.

cd wp-content/plugins
git clone -b main https://github.com/wpbones/WPKirk.git <your plugin folder>
⚠️

If you have cloned the repository instead of using the GitHub template, you should remove the .git folder before creating your own Git repository. So run

rm -rf .git

Install the dependencies packages to compile the assets

From inside your plugin folder, run:

npm install

Check the installation

Next, from inside your plugin folder try to run:

php bones

You must use php bones from WordPress Host, because it needs to load WordPress environment.

Naming your plugin

From the WordPress Host execute:

php bones install

Next, set the plugin name and the plugin namespace.

php bones rename <your-plugin-name> <your-plugin-namespace>

Start developing

Well, now you can go to WordPress backend admin area and activate your plugin and start developing. Also, review the readme.txt file and the {plugin-name}.php in order to complete the plugin information.

Remember to review the WordPress guide lines and check periodically any WP Bones update, by using:

php bones update

Of course, you can start to work on styles and Javascript by using the whatcher provided by the package.json file.

npm run start

All the assets in resources/assets are compiled and copied to the public folder.

Your development source assets:

        • my-styles-1.lessless
        • my-styles-2.scssSass
        • my-script.jsJavascript
        • my-hook.tsTypescript
        • my-react-component.jsxReactJS

Will be compiled and copied to the public folder:

      • my-styles-1.cssCSS
      • my-styles-2.cssCSS
      • my-script.jsJavascript
      • my-hook.jsJavascript
      • my-react-component.jsJavascript

Plugin Version

Before creating your plugin deploy version, probably you would update the plugin version. You may use

php bones version

You may use a specific version

php bones version --pre-patch

Take a look at how plugin versioning works versioning works

or auto-increment one of major.minor.patch value

php bones version --patch

Remember to follow SemVer rules. Here](https://semver.org/) you may found more information about SemVer

Before submitting

When your plugin is ready and you are satisfied with it, you can prepare a deploy version, by using:

php bones deploy ../deploy-version
đź’ˇ

The deploy will run also the build command, so the assets will be compressed and minified.

Submit to WordPress repository

Due to the WordPress repository rules, you have to prepare a deploy version of your plugin. You can use the deploy command along with the --wp option.

php bones deploy ../deploy-version --wp

Read more about the Before submit to WordPress repository.

You can copy the deploy-version content in the WordPress trunk subversion folder. Add and commit your files.