diff --git a/README.md b/README.md index 545d4912..5aa5dbc4 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ See the [Underscores website](https://underscores.me/) for more details. ### wp scaffold block -Generates PHP, JS and CSS code for registering a Gutenberg block. +Generates PHP, JS and CSS code for registering a Gutenberg block for a plugin or theme. ~~~ wp scaffold block [--title=] [--dashicon=<dashicon>] [--category=<category>] [--textdomain=<textdomain>] [--theme] [--plugin=<plugin>] [--force] @@ -91,6 +91,8 @@ wp scaffold block <slug> [--title=<title>] [--dashicon=<dashicon>] [--category=< Blocks are the fundamental element of the Gutenberg editor. They are the primary way in which plugins and themes can register their own functionality and extend the capabilities of the editor. Visit https://wordpress.org/gutenberg/handbook/block-api/ to learn more about Block API. +When you scaffold a block you must use either the theme or plugin option. + **OPTIONS** <slug> @@ -131,8 +133,18 @@ Visit https://wordpress.org/gutenberg/handbook/block-api/ to learn more about Bl # Generate a 'movie' block for the 'simple-life' theme $ wp scaffold block movie --title="Movie block" --theme=simple-life Success: Created block 'Movie block'. - - + + # Generate a 'movie' block for the 'movies' plugin + $ wp scaffold block movie --title="Movie block" --plugin=movies + Success: Created block 'Movie block'. + + # Create a new plugin and add two blocks + # Create plugin called books + $ wp scaffold plugin books + # Add a block called book to plugin books + $ wp scaffold block book --title="Book" --plugin=books + # Add a second block to plugin called books. + $ wp scaffold block books --title="Book List" --plugin=books ### wp scaffold child-theme diff --git a/src/Scaffold_Command.php b/src/Scaffold_Command.php index b415bb07..d67e79cc 100644 --- a/src/Scaffold_Command.php +++ b/src/Scaffold_Command.php @@ -201,11 +201,13 @@ private function _scaffold( $slug, $assoc_args, $defaults, $subdir, $templates ) } /** - * Generates PHP, JS and CSS code for registering a Gutenberg block. + * Generates PHP, JS and CSS code for registering a Gutenberg block for a plugin or theme. * * Blocks are the fundamental element of the Gutenberg editor. They are the primary way in which plugins and themes can register their own functionality and extend the capabilities of the editor. * Visit https://wordpress.org/gutenberg/handbook/block-api/ to learn more about Block API. * + * When you scaffold a block you must use either the theme or plugin option. + * * ## OPTIONS * * <slug> @@ -247,6 +249,18 @@ private function _scaffold( $slug, $assoc_args, $defaults, $subdir, $templates ) * $ wp scaffold block movie --title="Movie block" --theme=simple-life * Success: Created block 'Movie block'. * + * # Generate a 'movie' block for the 'movies' plugin + * $ wp scaffold block movie --title="Movie block" --plugin=movies + * Success: Created block 'Movie block'. + * + * # Create a new plugin and add two blocks + * # Create plugin called books + * $ wp scaffold plugin books + * # Add a block called book to plugin books + * $ wp scaffold block book --title="Book" --plugin=books + * # Add a second block to plugin called books. + * $ wp scaffold block books --title="Book List" --plugin=books + * * @subcommand block */ public function block( $args, $assoc_args ) {