OSDN Git Service

Move `--post_types` to taxonomy function
authorjmslbam <jmslbam@gmail.com>
Mon, 5 Aug 2013 21:54:35 +0000 (23:54 +0200)
committerjmslbam <jmslbam@gmail.com>
Mon, 5 Aug 2013 21:54:35 +0000 (23:54 +0200)
Because a CPT doesn't need this arg.

php/commands/scaffold.php

index 1354103..af10af5 100644 (file)
@@ -90,9 +90,13 @@ class Scaffold_Command extends WP_CLI_Command {
        function taxonomy( $args, $assoc_args ) {
                $defaults = array(
                        'textdomain' => '',
-                       'post_types' => 'post'
+                       'post_types' => "'post'"
                );
 
+               if( isset($assoc_args['post_types']) ) {
+                       $assoc_args['post_types'] = $this->quote_comma_list_elements( $assoc_args['post_types'] );
+               }
+
                $this->_scaffold( $args[0], $assoc_args, $defaults, '/taxonomies/', array(
                        'taxonomy.mustache',
                        'taxonomy_extended.mustache'
@@ -107,15 +111,12 @@ class Scaffold_Command extends WP_CLI_Command {
                        'theme'  => false,
                        'plugin' => false,
                        'raw'    => false,
-                       'post_types' => false,
                ) );
 
                $vars = $this->extract_args( $assoc_args, $defaults );
 
                $vars['slug'] = $slug;
 
-               $vars['post_types'] = $this->quote_comma_list_elements( $control_args['post_types'] );
-
                $vars['textdomain'] = $this->get_textdomain( $vars['textdomain'], $control_args );
 
                $vars['label'] = $control_args['label'];