@@ -63,6 +63,7 @@ class Theme_Command extends CommandWithUpgrade {
6363 'version ' ,
6464 'update_version ' ,
6565 'auto_update ' ,
66+ 'type ' ,
6667 ];
6768
6869 public function __construct () {
@@ -587,6 +588,9 @@ public function install( $args, $assoc_args ) {
587588 * +---------+----------------+
588589 */
589590 public function get ( $ args , $ assoc_args ) {
591+ /**
592+ * @var \WP_Theme $theme
593+ */
590594 $ theme = $ this ->fetcher ->get_check ( $ args [0 ] );
591595
592596 $ errors = $ theme ->errors ();
@@ -612,15 +616,23 @@ public function get( $args, $assoc_args ) {
612616 'tags ' ,
613617 'theme_root ' ,
614618 'theme_root_uri ' ,
619+ 'type ' ,
615620 ];
616621 $ theme_obj = new stdClass ();
617622 foreach ( $ theme_vars as $ var ) {
623+ // @phpstan-ignore-next-line
618624 $ theme_obj ->$ var = $ theme ->$ var ;
619625 }
620626
621627 $ theme_obj ->status = $ this ->get_status ( $ theme );
622628 $ theme_obj ->description = wordwrap ( $ theme_obj ->description );
623629
630+ // Determine theme type (block or classic). is_block_theme() was added in WP 5.9.
631+ $ theme_obj ->type = 'classic ' ;
632+ if ( method_exists ( $ theme , 'is_block_theme ' ) && $ theme ->is_block_theme () ) {
633+ $ theme_obj ->type = 'block ' ;
634+ }
635+
624636 if ( empty ( $ assoc_args ['fields ' ] ) ) {
625637 $ assoc_args ['fields ' ] = $ theme_vars ;
626638 }
@@ -775,7 +787,7 @@ public function is_installed( $args, $assoc_args ) {
775787 * ## OPTIONS
776788 *
777789 * <theme>
778- * : The plugin to check.
790+ * : The theme to check.
779791 *
780792 * ## EXAMPLES
781793 *
@@ -915,6 +927,7 @@ public function delete( $args, $assoc_args ) {
915927 * * version
916928 * * update_version
917929 * * auto_update
930+ * * type
918931 *
919932 * These fields are optionally available:
920933 *
@@ -927,9 +940,9 @@ public function delete( $args, $assoc_args ) {
927940 *
928941 * # List inactive themes.
929942 * $ wp theme list --status=inactive --format=csv
930- * name,status,update,version,update_version,auto_update
931- * twentyfourteen,inactive,none,3.8,,off
932- * twentysixteen,inactive,available,3.0,3.1,off
943+ * name,status,update,version,update_version,auto_update,type
944+ * twentyfourteen,inactive,none,3.8,,off,classic
945+ * twentysixteen,inactive,available,3.0,3.1,off,classic
933946 *
934947 * @subcommand list
935948 */
0 commit comments