public function child_theme( $args, $assoc_args ) {
		$theme_slug = $args[0];

		if ( in_array( $theme_slug, array( '.', '..' ), true ) ) {
			WP_CLI::error( "Invalid theme slug specified. The slug cannot be '.' or '..'." );
		}

		$defaults = array(
			'theme_name' => ucfirst( $theme_slug ),
			'author'     => 'Me',
			'author_uri' => '',
			'theme_uri'  => '',
		);

		$data                               = wp_parse_args( $assoc_args, $defaults );
		$data['slug']                       = $theme_slug;
		$data['parent_theme_function_safe'] = str_replace( array( ' ', '-' ), '_', $data['parent_theme'] );
		$data['description']                = ucfirst( $data['parent_theme'] ) . ' child theme.';

		$theme_dir = WP_CONTENT_DIR . "/themes/{$theme_slug}";

		$error_msg = $this->check_target_directory( 'theme', $theme_dir );
		if ( ! empty( $error_msg ) ) {
			WP_CLI::error( "Invalid theme slug specified. {$error_msg}" );
		}

		$theme_style_path     = "{$theme_dir}/style.css";
		$theme_functions_path = "{$theme_dir}/functions.php";

		$this->maybe_create_themes_dir();

		$files_to_create = array(
			$theme_style_path            => self::mustache_render( 'child_theme.mustache', $data ),
			$theme_functions_path        => self::mustache_render( 'child_theme_functions.mustache', $data ),
			"{$theme_dir}/.editorconfig" => file_get_contents( self::get_template_path( '.editorconfig' ) ),
		);
		$force           = \WP_CLI\Utils\get_flag_value( $assoc_args, 'force' );
		$files_written   = $this->create_files( $files_to_create, $force );
		$skip_message    = 'All theme files were skipped.';
		$success_message = "Created '{$theme_dir}'.";
		$this->log_whether_files_written( $files_written, $skip_message, $success_message );

		if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'activate' ) ) {
			WP_CLI::run_command( array( 'theme', 'activate', $theme_slug ) );
		} elseif ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'enable-network' ) ) {
			WP_CLI::run_command( array( 'theme', 'enable', $theme_slug ), array( 'network' => true ) );
		}
	}
public function child_theme( $args, $assoc_args ) {
		$theme_slug = $args[0];

		if ( in_array( $theme_slug, array( '.', '..' ), true ) ) {
			WP_CLI::error( "Invalid theme slug specified. The slug cannot be '.' or '..'." );
		}

		$defaults = array(
			'theme_name' => ucfirst( $theme_slug ),
			'author'     => 'Me',
			'author_uri' => '',
			'theme_uri'  => '',
		);

		$data                               = wp_parse_args( $assoc_args, $defaults );
		$data['slug']                       = $theme_slug;
		$data['parent_theme_function_safe'] = str_replace( array( ' ', '-' ), '_', $data['parent_theme'] );
		$data['description']                = ucfirst( $data['parent_theme'] ) . ' child theme.';

		$theme_dir = WP_CONTENT_DIR . "/themes/{$theme_slug}";

		$error_msg = $this->check_target_directory( 'theme', $theme_dir );
		if ( ! empty( $error_msg ) ) {
			WP_CLI::error( "Invalid theme slug specified. {$error_msg}" );
		}

		$theme_style_path     = "{$theme_dir}/style.css";
		$theme_functions_path = "{$theme_dir}/functions.php";

		$this->maybe_create_themes_dir();

		$files_to_create = array(
			$theme_style_path            => self::mustache_render( 'child_theme.mustache', $data ),
			$theme_functions_path        => self::mustache_render( 'child_theme_functions.mustache', $data ),
			"{$theme_dir}/.editorconfig" => file_get_contents( self::get_template_path( '.editorconfig' ) ),
		);
		$force           = \WP_CLI\Utils\get_flag_value( $assoc_args, 'force' );
		$files_written   = $this->create_files( $files_to_create, $force );
		$skip_message    = 'All theme files were skipped.';
		$success_message = "Created '{$theme_dir}'.";
		$this->log_whether_files_written( $files_written, $skip_message, $success_message );

		if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'activate' ) ) {
			WP_CLI::run_command( array( 'theme', 'activate', $theme_slug ) );
		} elseif ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'enable-network' ) ) {
			WP_CLI::run_command( array( 'theme', 'enable', $theme_slug ), array( 'network' => true ) );
		}
	}
public function child_theme ( $ args , $ assoc_args ) { $ theme_slug = $ args [ 0 ] ; if ( in_array ( $ theme_slug , array ( '.' , '..' ) , true ) ) { WP_CLI :: error ( "Invalid theme slug specified. The slug cannot be '.' or '..'." ) ; } $ defaults = array ( 'theme_name' => ucfirst ( $ theme_slug ) , 'author' => 'Me' , 'author_uri' => '' , 'theme_uri' => '' , ) ; $ data = wp_parse_args ( $ assoc_args , $ defaults ) ; $ data [ 'slug' ] = $ theme_slug ; $ data [ 'parent_theme_function_safe' ] = str_replace ( array ( ' ' , '-' ) , '_' , $ data [ 'parent_theme' ] ) ; $ data [ 'description' ] = ucfirst ( $ data [ 'parent_theme' ] ) . ' child theme.' ; $ theme_dir = WP_CONTENT_DIR . "/themes/{$theme_slug}" ; $ error_msg = $ this -> check_target_directory ( 'theme' , $ theme_dir ) ; if ( ! empty ( $ error_msg ) ) { WP_CLI :: error ( "Invalid theme slug specified. {$error_msg}" ) ; } $ theme_style_path = "{$theme_dir}/style.css" ; $ theme_functions_path = "{$theme_dir}/functions.php" ; $ this -> maybe_create_themes_dir ( ) ; $ files_to_create = array ( $ theme_style_path => self :: mustache_render ( 'child_theme.mustache' , $ data ) , $ theme_functions_path => self :: mustache_render ( 'child_theme_functions.mustache' , $ data ) , "{$theme_dir}/.editorconfig" => file_get_contents ( self :: get_template_path ( '.editorconfig' ) ) , ) ; $ force = \ WP_CLI \ Utils \ get_flag_value ( $ assoc_args , 'force' ) ; $ files_written = $ this -> create_files ( $ files_to_create , $ force ) ; $ skip_message = 'All theme files were skipped.' ; $ success_message = "Created '{$theme_dir}'." ; $ this -> log_whether_files_written ( $ files_written , $ skip_message , $ success_message ) ; if ( \ WP_CLI \ Utils \ get_flag_value ( $ assoc_args , 'activate' ) ) { WP_CLI :: run_command ( array ( 'theme' , 'activate' , $ theme_slug ) ) ; } elseif ( \ WP_CLI \ Utils \ get_flag_value ( $ assoc_args , 'enable-network' ) ) { WP_CLI :: run_command ( array ( 'theme' , 'enable' , $ theme_slug ) , array ( 'network' => true ) ) ; } }
Generates child theme based on an existing theme.

Creates a child theme folder with `functions.php` and `style.css` files.

## OPTIONS

<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

# 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'.

@subcommand child-theme
Generates child theme based on an existing theme .