ohevzion / generator-plugin-wp

Yeoman WordPress Plugin Generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

generator-plugin-wp Build Status

Yeoman generator for WordPress plugins.

Check out an example of a generated plugin.

Getting Started

Pre-requisites: You'll need node which comes with npm.

If you don't have Yeoman installed:

npm install -g yo

To install generator-plugin-wp from npm, run:

npm install -g generator-plugin-wp

To use generator-plugin-wp, cd to your WordPress plugins folder and:

yo plugin-wp

You'll be prompted with steps for creating your plugin.

Sub-generators

Once your nifty new plugin has been generated, cd into your new plugin's directory. While in the plugin directory, you can run additional commands called sub-generators to automatically generate files to enhance your plugin.

For the names of the include, cpt, options, and widget subgenerators remember that the plugin prefix will be added to the class name so no need to include the original plugin name there! Think of it as the file name for each instead.

Tests

By default the plugin generator adds some built in tests for you to add on to as you develop your plugin! To run these tests run the install-wp-tests.sh script in the bin folder with the proper database details for your local setup.

Once you've run the install-wp-tests.sh script you can run just phpunit in the main folder of your plugin.

If you don't want tests included in your plugin when it is generated run the main generator with the --notests option.

Adding Packages with Composer

If you chose composer as the autoloader option during the plugin's initiation, you can use composer to add additional dependencies.

Let's cd into our new plugin's directory and add CMB2:

composer require webdevstudios/cmb2

CMB2 will now appear under vendor

-plugins
  -wds-foo-plugin
    -vendor
      -webdevstudios
        -cmb2

Contributors

The following humans contributed to this awesome generator:

#### CamdenSegal, jtsternberg, jazzsequence, binarygary, bradp, JeffreyNaval, gregrickaby, DevNIX, JPry, ![] (https://avatars2.githubusercontent.com/u/2522431?v=3&s=20) RC Lations

See the complete list of WebDevStudios packages: https://packagist.org/packages/webdevstudios/

About

Yeoman WordPress Plugin Generator


Languages

Language:JavaScript 62.4%Language:PHP 32.2%Language:Shell 5.3%Language:CSS 0.1%