Skip to content

Commit

Permalink
Merge pull request #408 from ernilambar/406-fix-activate-multiple-themes
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy authored Apr 26, 2024
2 parents fbd4222 + 3ee76ca commit afdbff3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions features/theme-install.feature
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,10 @@ Feature: Install WordPress themes
Success: Switched to 'Twenty Twelve' theme.
Success: Theme already installed.
"""

Scenario: Installation of multiple themes with activate
When I try `wp theme install twentytwelve twentyeleven --activate`
Then STDERR should contain:
"""
Warning: Only a single theme can be active.
"""
3 changes: 3 additions & 0 deletions src/Theme_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,9 @@ protected function filter_item_list( $items, $args ) {
* $ wp theme install http://s3.amazonaws.com/bucketname/my-theme.zip?AWSAccessKeyId=123&Expires=456&Signature=abcdef
*/
public function install( $args, $assoc_args ) {
if ( count( $args ) > 1 && Utils\get_flag_value( $assoc_args, 'activate', false ) ) {
WP_CLI::warning( 'Only a single theme can be active.' );
}

$theme_root = get_theme_root();
if ( $theme_root && ! is_dir( $theme_root ) ) {
Expand Down

0 comments on commit afdbff3

Please sign in to comment.