public function post_type( $args, $assoc_args ) {

		if ( strlen( $args[0] ) > 20 ) {
			WP_CLI::error( 'Post type slugs cannot exceed 20 characters in length.' );
		}

		$defaults = array(
			'textdomain' => '',
			'dashicon'   => 'admin-post',
		);

		$templates = array(
			'post_type.mustache',
			'post_type_extended.mustache',
		);

		$this->scaffold( $args[0], $assoc_args, $defaults, '/post-types/', $templates );
	}
public function post_type( $args, $assoc_args ) {

		if ( strlen( $args[0] ) > 20 ) {
			WP_CLI::error( 'Post type slugs cannot exceed 20 characters in length.' );
		}

		$defaults = array(
			'textdomain' => '',
			'dashicon'   => 'admin-post',
		);

		$templates = array(
			'post_type.mustache',
			'post_type_extended.mustache',
		);

		$this->scaffold( $args[0], $assoc_args, $defaults, '/post-types/', $templates );
	}
public function post_type ( $ args , $ assoc_args ) { if ( strlen ( $ args [ 0 ] ) > 20 ) { WP_CLI :: error ( 'Post type slugs cannot exceed 20 characters in length.' ) ; } $ defaults = array ( 'textdomain' => '' , 'dashicon' => 'admin-post' , ) ; $ templates = array ( 'post_type.mustache' , 'post_type_extended.mustache' , ) ; $ this -> scaffold ( $ args [ 0 ] , $ assoc_args , $ defaults , '/post-types/' , $ templates ) ; }
Generates PHP code for registering a custom post type.

## OPTIONS

<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

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

@subcommand post-type

@alias      cpt
Generates PHP code for registering a custom post type .