2017 © Pedro PelĂĄez
 

wp-cli-package scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.

image

wp-cli/scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.

  • Sunday, July 29, 2018
  • by danielbachhuber
  • Repository
  • 5 Watchers
  • 32 Stars
  • 259,930 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 46 Forks
  • 19 Open issues
  • 27 Versions
  • 22 % Grown

The README.md

wp-cli/scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc., (*1)

Testing, (*2)

Quick links: Using | Installing | Contributing | Support, (*3)

Using

This package implements the following commands:, (*4)

wp scaffold

Generates code for post types, taxonomies, plugins, child themes, etc., (*5)

wp scaffold

EXAMPLES, (*6)

# Generate a new plugin with unit tests.
$ wp scaffold plugin sample-plugin
Success: Created plugin files.
Success: Created test files.

# Generate theme based on _s.
$ wp scaffold _s sample-theme --theme_name="Sample Theme" --author="John Doe"
Success: Created theme 'Sample Theme'.

# Generate code for post type registration in given theme.
$ wp scaffold post-type movie --label=Movie --theme=simple-life
Success: Created '/var/www/example.com/public_html/wp-content/themes/simple-life/post-types/movie.php'.

wp scaffold underscores

Generates starter code for a theme based on _s., (*7)

wp scaffold underscores <slug> [--activate] [--enable-network] [--theme_name=<title>] [--author=<full-name>] [--author_uri=<uri>] [--sassify] [--woocommerce] [--force]

See the Underscores website for more details., (*8)

OPTIONS, (*9)

<slug>
    The slug for the new theme, used for prefixing functions.

[--activate]
    Activate the newly downloaded theme.

[--enable-network]
    Enable the newly downloaded theme for the entire network.

[--theme_name=<title>]
    What to put in the 'Theme Name:' header in 'style.css'.

[--author=<full-name>]
    What to put in the 'Author:' header in 'style.css'.

[--author_uri=<uri>]
    What to put in the 'Author URI:' header in 'style.css'.

[--sassify]
    Include stylesheets as SASS.

[--woocommerce]
    Include WooCommerce boilerplate files.

[--force]
    Overwrite files that already exist.

EXAMPLES, (*10)

# Generate a theme with name "Sample Theme" and author "John Doe"
$ wp scaffold _s sample-theme --theme_name="Sample Theme" --author="John Doe"
Success: Created theme 'Sample Theme'.

wp scaffold block

Generates PHP, JS and CSS code for registering a Gutenberg block for a plugin or theme., (*11)

wp scaffold block <slug> [--title=<title>] [--dashicon=<dashicon>] [--category=<category>] [--theme] [--plugin=<plugin>] [--force]

Warning: wp scaffold block is deprecated., (*12)

The official script to generate a block is the @wordpress/create-block package., (*13)

See the Create a Block tutorial for a complete walk-through., (*14)

OPTIONS, (*15)

<slug>
    The internal name of the block.

[--title=<title>]
    The display title for your block.

[--dashicon=<dashicon>]
    The dashicon to make it easier to identify your block.

[--category=<category>]
    The category name to help users browse and discover your block.
    ---
    default: widgets
    options:
      - common
      - embed
      - formatting
      - layout
      - widgets
    ---

[--theme]
    Create files in the active theme directory. Specify a theme with `--theme=<theme>` to have the file placed in that theme.

[--plugin=<plugin>]
    Create files in the given plugin's directory.

[--force]
    Overwrite files that already exist.

wp scaffold child-theme

Generates child theme based on an existing theme., (*16)

wp scaffold child-theme <slug> --parent_theme=<slug> [--theme_name=<title>] [--author=<full-name>] [--author_uri=<uri>] [--theme_uri=<uri>] [--activate] [--enable-network] [--force]

Creates a child theme folder with functions.php and style.css files., (*17)

OPTIONS, (*18)

<slug>
    The slug for the new child theme.

--parent_theme=<slug>
    What to put in the 'Template:' header in 'style.css'.

[--theme_name=<title>]
    What to put in the 'Theme Name:' header in 'style.css'.

[--author=<full-name>]
    What to put in the 'Author:' header in 'style.css'.

[--author_uri=<uri>]
    What to put in the 'Author URI:' header in 'style.css'.

[--theme_uri=<uri>]
    What to put in the 'Theme URI:' header in 'style.css'.

[--activate]
    Activate the newly created child theme.

[--enable-network]
    Enable the newly created child theme for the entire network.

[--force]
    Overwrite files that already exist.

EXAMPLES, (*19)

# Generate a 'sample-theme' child theme based on TwentySixteen
$ wp scaffold child-theme sample-theme --parent_theme=twentysixteen
Success: Created '/var/www/example.com/public_html/wp-content/themes/sample-theme'.

wp scaffold plugin

Generates starter code for a plugin., (*20)

wp scaffold plugin <slug> [--dir=<dirname>] [--plugin_name=<title>] [--plugin_description=<description>] [--plugin_author=<author>] [--plugin_author_uri=<url>] [--plugin_uri=<url>] [--skip-tests] [--ci=<provider>] [--activate] [--activate-network] [--force]

The following files are always generated:, (*21)

  • plugin-slug.php is the main PHP plugin file.
  • readme.txt is the readme file for the plugin.
  • package.json needed by NPM holds various metadata relevant to the project. Packages: grunt, grunt-wp-i18n and grunt-wp-readme-to-markdown. Scripts: start, readme, i18n.
  • Gruntfile.js is the JS file containing Grunt tasks. Tasks: i18n containing addtextdomain and makepot, readme containing wp_readme_to_markdown.
  • .editorconfig is the configuration file for Editor.
  • .gitignore tells which files (or patterns) git should ignore.
  • .distignore tells which files and folders should be ignored in distribution.

The following files are also included unless the --skip-tests is used:, (*22)

  • phpunit.xml.dist is the configuration file for PHPUnit.
  • .circleci/config.yml is the configuration file for CircleCI. Use --ci=<provider> to select a different service.
  • bin/install-wp-tests.sh configures the WordPress test suite and a test database.
  • tests/bootstrap.php is the file that makes the current plugin active when running the test suite.
  • tests/test-sample.php is a sample file containing test cases.
  • .phpcs.xml.dist is a collection of PHP_CodeSniffer rules.

OPTIONS, (*23)

<slug>
    The internal name of the plugin.

[--dir=<dirname>]
    Put the new plugin in some arbitrary directory path. Plugin directory will be path plus supplied slug.

[--plugin_name=<title>]
    What to put in the 'Plugin Name:' header.

[--plugin_description=<description>]
    What to put in the 'Description:' header.

[--plugin_author=<author>]
    What to put in the 'Author:' header.

[--plugin_author_uri=<url>]
    What to put in the 'Author URI:' header.

[--plugin_uri=<url>]
    What to put in the 'Plugin URI:' header.

[--skip-tests]
    Don't generate files for unit testing.

[--ci=<provider>]
    Choose a configuration file for a continuous integration provider.
    ---
    default: circle
    options:
      - circle
      - gitlab
      - bitbucket
      - github
    ---

[--activate]
    Activate the newly generated plugin.

[--activate-network]
    Network activate the newly generated plugin.

[--force]
    Overwrite files that already exist.

EXAMPLES, (*24)

$ wp scaffold plugin sample-plugin
Success: Created plugin files.
Success: Created test files.

wp scaffold plugin-tests

Generates files needed for running PHPUnit tests in a plugin., (*25)

wp scaffold plugin-tests [<plugin>] [--dir=<dirname>] [--ci=<provider>] [--force]

The following files are generated by default:, (*26)

  • phpunit.xml.dist is the configuration file for PHPUnit.
  • .circleci/config.yml is the configuration file for CircleCI. Use --ci=<provider> to select a different service.
  • bin/install-wp-tests.sh configures the WordPress test suite and a test database.
  • tests/bootstrap.php is the file that makes the current plugin active when running the test suite.
  • tests/test-sample.php is a sample file containing the actual tests.
  • .phpcs.xml.dist is a collection of PHP_CodeSniffer rules.

Learn more from the plugin unit tests documentation., (*27)

ENVIRONMENT, (*28)

The tests/bootstrap.php file looks for the WP_TESTS_DIR environment variable., (*29)

OPTIONS, (*30)

[<plugin>]
    The name of the plugin to generate test files for.

[--dir=<dirname>]
    Generate test files for a non-standard plugin path. If no plugin slug is specified, the directory name is used.

[--ci=<provider>]
    Choose a configuration file for a continuous integration provider.
    ---
    default: circle
    options:
      - circle
      - gitlab
      - bitbucket
      - github
    ---

[--force]
    Overwrite files that already exist.

EXAMPLES, (*31)

# Generate unit test files for plugin 'sample-plugin'.
$ wp scaffold plugin-tests sample-plugin
Success: Created test files.

wp scaffold post-type

Generates PHP code for registering a custom post type., (*32)

wp scaffold post-type <slug> [--label=<label>] [--textdomain=<textdomain>] [--dashicon=<dashicon>] [--theme] [--plugin=<plugin>] [--raw] [--force]

OPTIONS, (*33)

<slug>
    The internal name of the post type.

[--label=<label>]
    The text used to translate the update messages.

[--textdomain=<textdomain>]
    The textdomain to use for the labels.

[--dashicon=<dashicon>]
    The dashicon to use in the menu.

[--theme]
    Create a file in the active theme directory, instead of sending to
    STDOUT. Specify a theme with `--theme=<theme>` to have the file placed in that theme.

[--plugin=<plugin>]
    Create a file in the given plugin's directory, instead of sending to STDOUT.

[--raw]
    Just generate the `register_post_type()` call and nothing else.

[--force]
    Overwrite files that already exist.

EXAMPLES, (*34)

# Generate a 'movie' post type for the 'simple-life' theme
$ wp scaffold post-type movie --label=Movie --theme=simple-life
Success: Created '/var/www/example.com/public_html/wp-content/themes/simple-life/post-types/movie.php'.

wp scaffold taxonomy

Generates PHP code for registering a custom taxonomy., (*35)

wp scaffold taxonomy <slug> [--post_types=<post-types>] [--label=<label>] [--textdomain=<textdomain>] [--theme] [--plugin=<plugin>] [--raw] [--force]

OPTIONS, (*36)

<slug>
    The internal name of the taxonomy.

[--post_types=<post-types>]
    Post types to register for use with the taxonomy.

[--label=<label>]
    The text used to translate the update messages.

[--textdomain=<textdomain>]
    The textdomain to use for the labels.

[--theme]
    Create a file in the active theme directory, instead of sending to
    STDOUT. Specify a theme with `--theme=<theme>` to have the file placed in that theme.

[--plugin=<plugin>]
    Create a file in the given plugin's directory, instead of sending to STDOUT.

[--raw]
    Just generate the `register_taxonomy()` call and nothing else.

[--force]
    Overwrite files that already exist.

EXAMPLES, (*37)

# Generate PHP code for registering a custom taxonomy and save in a file
$ wp scaffold taxonomy venue --post_types=event,presentation > taxonomy.php

wp scaffold theme-tests

Generates files needed for running PHPUnit tests in a theme., (*38)

wp scaffold theme-tests [<theme>] [--dir=<dirname>] [--ci=<provider>] [--force]

The following files are generated by default:, (*39)

  • phpunit.xml.dist is the configuration file for PHPUnit.
  • .circleci/config.yml is the configuration file for CircleCI. Use --ci=<provider> to select a different service.
  • bin/install-wp-tests.sh configures the WordPress test suite and a test database.
  • tests/bootstrap.php is the file that makes the current theme active when running the test suite.
  • tests/test-sample.php is a sample file containing the actual tests.
  • .phpcs.xml.dist is a collection of PHP_CodeSniffer rules.

Learn more from the plugin unit tests documentation., (*40)

ENVIRONMENT, (*41)

The tests/bootstrap.php file looks for the WP_TESTS_DIR environment variable., (*42)

OPTIONS, (*43)

[<theme>]
    The name of the theme to generate test files for.

[--dir=<dirname>]
    Generate test files for a non-standard theme path. If no theme slug is specified, the directory name is used.

[--ci=<provider>]
    Choose a configuration file for a continuous integration provider.
    ---
    default: circle
    options:
      - circle
      - gitlab
      - bitbucket
      - github
    ---

[--force]
    Overwrite files that already exist.

EXAMPLES, (*44)

# Generate unit test files for theme 'twentysixteenchild'.
$ wp scaffold theme-tests twentysixteenchild
Success: Created test files.

Installing

This package is included with WP-CLI itself, no additional installation necessary., (*45)

To install the latest version of this package over what's included in WP-CLI, run:, (*46)

wp package install git@github.com:wp-cli/scaffold-command.git

Contributing

We appreciate you taking the initiative to contribute to this project., (*47)

Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation., (*48)

For a more thorough introduction, check out WP-CLI's guide to contributing. This package follows those policy and guidelines., (*49)

Reporting a bug

Think you’ve found a bug? We’d love for you to help us get it fixed., (*50)

Before you create a new issue, you should search existing issues to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version., (*51)

Once you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please create a new issue. Include as much detail as you can, and clear steps to reproduce if possible. For more guidance, review our bug report documentation., (*52)

Creating a pull request

Want to contribute a new feature? Please first open a new issue to discuss whether the feature is a good fit for the project., (*53)

Once you've decided to commit the time to seeing your pull request through, please follow our guidelines for creating a pull request to make sure it's a pleasant experience. See "Setting up" for details specific to working on this package locally., (*54)

Support

GitHub issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support, (*55)

This README.md is generated dynamically from the project's codebase using wp scaffold package-readme (doc). To suggest changes, please submit a pull request against the corresponding part of the codebase., (*56)

The Versions

29/07 2018

dev-master

9999999-dev https://github.com/wp-cli/scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

29/07 2018

v1.2.0

1.2.0.0 https://github.com/wp-cli/scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

20/04 2018

v1.1.3

1.1.3.0 https://github.com/wp-cli/scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

20/04 2018

dev-refresh-scaffold-files

dev-refresh-scaffold-files https://github.com/wp-cli/scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

20/04 2018

dev-144-fix-php-72-unit-test-incompatibility

dev-144-fix-php-72-unit-test-incompatibility https://github.com/wp-cli/scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

10/04 2018

dev-127-use-correct-theme-directories

dev-127-use-correct-theme-directories https://github.com/wp-cli/scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

26/02 2018

dev-cci2

dev-cci2 https://github.com/wp-cli/scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

29/01 2018

v1.1.2

1.1.2.0 https://github.com/wp-cli/scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

29/01 2018

dev-prerelease-1.1.2

dev-prerelease-1.1.2 https://github.com/wp-cli/scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

18/12 2017

v1.1.1

1.1.1.0 https://github.com/wp-cli/scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

28/11 2017

v1.1.0

1.1.0.0 https://github.com/wp-cli/scaffold-command

Generate code for post types, taxonomies, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

28/11 2017

dev-add/scaffold-block

dev-add/scaffold-block https://github.com/wp-cli/scaffold-command

Generate code for post types, taxonomies, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

21/11 2017

v1.0.12

1.0.12.0 https://github.com/wp-cli/scaffold-command

Generate code for post types, taxonomies, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

14/11 2017

dev-3928-cmd-layout

dev-3928-cmd-layout https://github.com/wp-cli/scaffold-command

Generate code for post types, taxonomies, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

01/11 2017

v1.0.11

1.0.11.0 https://github.com/wp-cli/scaffold-command

Generate code for post types, taxonomies, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

15/10 2017

v1.0.10

1.0.10.0 https://github.com/wp-cli/scaffold-command

Generate code for post types, taxonomies, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

11/10 2017

v1.0.9

1.0.9.0 https://github.com/wp-cli/scaffold-command

Generate code for post types, taxonomies, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

03/10 2017

v1.0.8

1.0.8.0 https://github.com/wp-cli/scaffold-command

Generate code for post types, taxonomies, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

23/08 2017

v1.0.7

1.0.7.0 https://github.com/wp-cli/scaffold-command

Generate code for post types, taxonomies, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

22/08 2017

v1.0.6

1.0.6.0 https://github.com/wp-cli/scaffold-command

Generate code for post types, taxonomies, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

04/08 2017

v1.0.5

1.0.5.0 https://github.com/wp-cli/scaffold-command

Generate code for post types, taxonomies, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

30/05 2017

v1.0.4

1.0.4.0 https://github.com/wp-cli/scaffold-command

Generate code for post types, taxonomies, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

30/04 2017

v1.0.3

1.0.3.0 https://github.com/wp-cli/scaffold-command

Generate code for post types, taxonomies, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

28/04 2017

v1.0.2

1.0.2.0 https://github.com/wp-cli/scaffold-command

Generate code for post types, taxonomies, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

17/04 2017

v1.0.1

1.0.1.0 https://github.com/wp-cli/scaffold-command

Generate code for post types, taxonomies, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

12/04 2017

dev-rm-template

dev-rm-template https://github.com/wp-cli/scaffold-command

Generate code for post types, taxonomies, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires

12/04 2017

v1.0.0

1.0.0.0 https://github.com/wp-cli/scaffold-command

Generate code for post types, taxonomies, plugins, child themes, etc.

  Sources   Download

MIT

The Development Requires