From 685517e8a87527870ba9e41570083335da9d0122 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 11 Nov 2025 08:55:06 +0000 Subject: [PATCH 1/9] Initial plan From ea7caba4238740800e93a77d4b4cc30f79eeb78d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 11 Nov 2025 09:04:01 +0000 Subject: [PATCH 2/9] Add type field to distinguish block vs classic themes Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/theme.feature | 42 ++++++++++++++++++++++++++++++ src/Theme_Command.php | 8 ++++++ src/WP_CLI/ParseThemeNameInput.php | 7 +++++ 3 files changed, 57 insertions(+) diff --git a/features/theme.feature b/features/theme.feature index a604052f..405cb8f9 100644 --- a/features/theme.feature +++ b/features/theme.feature @@ -738,3 +738,45 @@ Feature: Manage WordPress themes """ Warning: example: This update requires PHP version 100 """ + + @require-wp-5.9 + Scenario: Check theme type field for block themes + Given a WP install + + When I run `wp theme install twentytwentyfour` + Then STDOUT should contain: + """ + Theme installed successfully. + """ + + When I run `wp theme list --fields=name,type` + Then STDOUT should be a table containing rows: + | name | type | + | twentytwentyfour | block | + + When I run `wp theme get twentytwentyfour --field=type` + Then STDOUT should be: + """ + block + """ + + Scenario: Check theme type field for classic themes + Given a WP install + + When I run `wp theme install twentytwelve` + Then STDOUT should contain: + """ + Theme installed successfully. + """ + + When I run `wp theme list --fields=name,type --name=twentytwelve` + Then STDOUT should be a table containing rows: + | name | type | + | twentytwelve | classic | + + When I run `wp theme get twentytwelve --field=type` + Then STDOUT should be: + """ + classic + """ + diff --git a/src/Theme_Command.php b/src/Theme_Command.php index 5ae8459f..29d43a06 100644 --- a/src/Theme_Command.php +++ b/src/Theme_Command.php @@ -63,6 +63,7 @@ class Theme_Command extends CommandWithUpgrade { 'version', 'update_version', 'auto_update', + 'type', ]; public function __construct() { @@ -612,6 +613,7 @@ public function get( $args, $assoc_args ) { 'tags', 'theme_root', 'theme_root_uri', + 'type', ]; $theme_obj = new stdClass(); foreach ( $theme_vars as $var ) { @@ -621,6 +623,12 @@ public function get( $args, $assoc_args ) { $theme_obj->status = $this->get_status( $theme ); $theme_obj->description = wordwrap( $theme_obj->description ); + // Determine theme type (block or classic). is_block_theme() was added in WP 5.9. + $theme_obj->type = 'classic'; + if ( method_exists( $theme, 'is_block_theme' ) && $theme->is_block_theme() ) { + $theme_obj->type = 'block'; + } + if ( empty( $assoc_args['fields'] ) ) { $assoc_args['fields'] = $theme_vars; } diff --git a/src/WP_CLI/ParseThemeNameInput.php b/src/WP_CLI/ParseThemeNameInput.php index 6b6433c3..52b7b0ef 100644 --- a/src/WP_CLI/ParseThemeNameInput.php +++ b/src/WP_CLI/ParseThemeNameInput.php @@ -131,6 +131,12 @@ private function get_all_themes() { $requires_php = ! empty( $theme->get( 'RequiresPHP' ) ) ? $theme->get( 'RequiresPHP' ) : ''; } + // Determine theme type (block or classic). is_block_theme() was added in WP 5.9. + $theme_type = 'classic'; + if ( method_exists( $theme, 'is_block_theme' ) && $theme->is_block_theme() ) { + $theme_type = 'block'; + } + $items[ $stylesheet ] = [ 'name' => $key, 'status' => $this->get_status( $theme ), @@ -146,6 +152,7 @@ private function get_all_themes() { 'requires' => $requires, 'requires_php' => $requires_php, 'update_unavailable_reason' => isset( $update_unavailable_reason ) ? $update_unavailable_reason : '', + 'type' => $theme_type, ]; // Compare version and update information in theme list. From 8ebddaf310db4048051d151cb99028f0c9d711cb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 11 Nov 2025 09:05:30 +0000 Subject: [PATCH 3/9] Update documentation for theme list command to include type field Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- src/Theme_Command.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Theme_Command.php b/src/Theme_Command.php index 29d43a06..8214947d 100644 --- a/src/Theme_Command.php +++ b/src/Theme_Command.php @@ -923,6 +923,7 @@ public function delete( $args, $assoc_args ) { * * version * * update_version * * auto_update + * * type * * These fields are optionally available: * @@ -935,7 +936,7 @@ public function delete( $args, $assoc_args ) { * * # List inactive themes. * $ wp theme list --status=inactive --format=csv - * name,status,update,version,update_version,auto_update + * name,status,update,version,update_version,auto_update,type * twentyfourteen,inactive,none,3.8,,off * twentysixteen,inactive,available,3.0,3.1,off * From a946108a07b8719802667262f383b4df616823ef Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 11 Nov 2025 10:55:17 +0100 Subject: [PATCH 4/9] PHPStan fix --- src/Theme_Command.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Theme_Command.php b/src/Theme_Command.php index 8214947d..52ef7548 100644 --- a/src/Theme_Command.php +++ b/src/Theme_Command.php @@ -588,6 +588,9 @@ public function install( $args, $assoc_args ) { * +---------+----------------+ */ public function get( $args, $assoc_args ) { + /** + * @var \WP_Theme $theme + */ $theme = $this->fetcher->get_check( $args[0] ); $errors = $theme->errors(); @@ -613,10 +616,10 @@ public function get( $args, $assoc_args ) { 'tags', 'theme_root', 'theme_root_uri', - 'type', ]; $theme_obj = new stdClass(); foreach ( $theme_vars as $var ) { + // @phpstan-ignore-next-line $theme_obj->$var = $theme->$var; } From 9b23d374fd50a57e7ebb536f1a65e3ce158347a7 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 11 Nov 2025 11:22:03 +0100 Subject: [PATCH 5/9] Adjust some tests --- features/theme.feature | 25 ++++++------------------- features/upgradables.feature | 2 +- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/features/theme.feature b/features/theme.feature index 405cb8f9..3f20d9f8 100644 --- a/features/theme.feature +++ b/features/theme.feature @@ -87,8 +87,8 @@ Feature: Manage WordPress themes When I run `wp theme list` Then STDOUT should be a table containing rows: - | name | status | update | version | update_version | auto_update | - | twentytwelve | inactive | available | 1.4 | {UPDATE_VERSION} | off | + | name | status | update | version | update_version | auto_update | type | + | twentytwelve | inactive | available | 1.4 | {UPDATE_VERSION} | off | classic | When I run `wp theme activate twentytwelve` Then STDOUT should not be empty @@ -687,8 +687,8 @@ Feature: Manage WordPress themes When I run `wp theme list` Then STDOUT should be a table containing rows: - | name | status | update | version | update_version | auto_update | requires | requires_php | - | example | inactive | unavailable | 1.0.0 | 2.0.0 | off | 100 | 5.6 | + | name | status | update | version | update_version | auto_update | type |requires | requires_php | + | example | inactive | unavailable | 1.0.0 | 2.0.0 | off | classic | 100 | 5.6 | When I try `wp theme update example` Then STDERR should contain: @@ -730,8 +730,8 @@ Feature: Manage WordPress themes When I run `wp theme list` Then STDOUT should be a table containing rows: - | name | status | update | version | update_version | auto_update | requires | requires_php | - | example | inactive | unavailable | 1.0.0 | 2.0.0 | off | 3.7 | 100 | + | name | status | update | version | update_version | auto_update | type |requires | requires_php | + | example | inactive | unavailable | 1.0.0 | 2.0.0 | off | classic | 3.7 | 100 | When I try `wp theme update example` Then STDERR should contain: @@ -743,12 +743,6 @@ Feature: Manage WordPress themes Scenario: Check theme type field for block themes Given a WP install - When I run `wp theme install twentytwentyfour` - Then STDOUT should contain: - """ - Theme installed successfully. - """ - When I run `wp theme list --fields=name,type` Then STDOUT should be a table containing rows: | name | type | @@ -763,12 +757,6 @@ Feature: Manage WordPress themes Scenario: Check theme type field for classic themes Given a WP install - When I run `wp theme install twentytwelve` - Then STDOUT should contain: - """ - Theme installed successfully. - """ - When I run `wp theme list --fields=name,type --name=twentytwelve` Then STDOUT should be a table containing rows: | name | type | @@ -779,4 +767,3 @@ Feature: Manage WordPress themes """ classic """ - diff --git a/features/upgradables.feature b/features/upgradables.feature index 278f1275..baa40639 100644 --- a/features/upgradables.feature +++ b/features/upgradables.feature @@ -58,7 +58,7 @@ Feature: Manage WordPress themes and plugins Then STDOUT should not be empty And save STDOUT as {UPDATE_VERSION} - When I run `wp list` + When I run `wp list --fields=name,status,update,version,update_version,auto_update` Then STDOUT should be a table containing rows: | name | status | update | version | update_version | auto_update | | | inactive | available | | {UPDATE_VERSION} | off | From 500f97656d6b8d244682c81b2e65be06b1163d95 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 11 Nov 2025 11:42:04 +0100 Subject: [PATCH 6/9] More test fixes --- features/theme.feature | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/features/theme.feature b/features/theme.feature index 3f20d9f8..7f2a4a85 100644 --- a/features/theme.feature +++ b/features/theme.feature @@ -105,8 +105,8 @@ Feature: Manage WordPress themes When I run `wp theme list` Then STDOUT should be a table containing rows: - | name | status | update | version | update_version | auto_update | - | twentytwelve | active | available | 1.5 | {UPDATE_VERSION} | off | + | name | status | update | version | update_version | auto_update | type | + | twentytwelve | active | available | 1.5 | {UPDATE_VERSION} | off | classic | When I try `wp theme update` Then STDERR should be: @@ -757,7 +757,8 @@ Feature: Manage WordPress themes Scenario: Check theme type field for classic themes Given a WP install - When I run `wp theme list --fields=name,type --name=twentytwelve` + When I run `wp theme install twentytwelve --force` + And I run `wp theme list --fields=name,type --name=twentytwelve` Then STDOUT should be a table containing rows: | name | type | | twentytwelve | classic | From a12128bc54403b5ef2409493256bd3c790001be1 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 19 Dec 2025 10:41:11 +0100 Subject: [PATCH 7/9] Update features/theme.feature Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- features/theme.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/theme.feature b/features/theme.feature index 4471253d..92cfdc70 100644 --- a/features/theme.feature +++ b/features/theme.feature @@ -765,7 +765,7 @@ Feature: Manage WordPress themes When I run `wp theme list` Then STDOUT should be a table containing rows: - | name | status | update | version | update_version | auto_update | type |requires | requires_php | + | name | status | update | version | update_version | auto_update | type | requires | requires_php | | example | inactive | unavailable | 1.0.0 | 2.0.0 | off | classic | 3.7 | 100 | When I try `wp theme update example` From 0a536036a206d735ff0e9721bcd1c304e71b5203 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 19 Dec 2025 10:41:31 +0100 Subject: [PATCH 8/9] Update src/Theme_Command.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/Theme_Command.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Theme_Command.php b/src/Theme_Command.php index 52ef7548..a0c459ab 100644 --- a/src/Theme_Command.php +++ b/src/Theme_Command.php @@ -940,8 +940,8 @@ public function delete( $args, $assoc_args ) { * # List inactive themes. * $ wp theme list --status=inactive --format=csv * name,status,update,version,update_version,auto_update,type - * twentyfourteen,inactive,none,3.8,,off - * twentysixteen,inactive,available,3.0,3.1,off + * twentyfourteen,inactive,none,3.8,,off,classic + * twentysixteen,inactive,available,3.0,3.1,off,classic * * @subcommand list */ From 4aebd14f085c260e9dc57e4743e3b82e4b27a0b8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 19 Dec 2025 09:45:16 +0000 Subject: [PATCH 9/9] Add type to theme_vars array and fix table spacing in tests Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/theme.feature | 4 ++-- src/Theme_Command.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/features/theme.feature b/features/theme.feature index 92cfdc70..259f1f68 100644 --- a/features/theme.feature +++ b/features/theme.feature @@ -722,8 +722,8 @@ Feature: Manage WordPress themes When I run `wp theme list` Then STDOUT should be a table containing rows: - | name | status | update | version | update_version | auto_update | type |requires | requires_php | - | example | inactive | unavailable | 1.0.0 | 2.0.0 | off | classic | 100 | 5.6 | + | name | status | update | version | update_version | auto_update | type | requires | requires_php | + | example | inactive | unavailable | 1.0.0 | 2.0.0 | off | classic | 100 | 5.6 | When I try `wp theme update example` Then STDERR should contain: diff --git a/src/Theme_Command.php b/src/Theme_Command.php index a0c459ab..5deaad98 100644 --- a/src/Theme_Command.php +++ b/src/Theme_Command.php @@ -616,6 +616,7 @@ public function get( $args, $assoc_args ) { 'tags', 'theme_root', 'theme_root_uri', + 'type', ]; $theme_obj = new stdClass(); foreach ( $theme_vars as $var ) {