public function activate( $args = array() ) {
		$theme = $this->fetcher->get_check( $args[0] );

		$errors = $theme->errors();
		if ( is_wp_error( $errors ) ) {
			$message = $errors->get_error_message();
			WP_CLI::error( $message );
		}

		$name = $theme->get( 'Name' );

		if ( 'active' === $this->get_status( $theme ) ) {
			WP_CLI::warning( "The '$name' theme is already active." );
			return;
		}

		if ( $theme->get_stylesheet() !== $theme->get_template() && ! $this->fetcher->get( $theme->get_template() ) ) {
			WP_CLI::error( "The '{$theme->get_stylesheet()}' theme cannot be activated without its parent, '{$theme->get_template()}'." );
		}

		switch_theme( $theme->get_template(), $theme->get_stylesheet() );

		if ( $this->is_active_theme( $theme ) ) {
			WP_CLI::success( "Switched to '$name' theme." );
		} else {
			WP_CLI::error( "Could not switch to '$name' theme." );
		}
	}
public function activate( $args = array() ) {
		$theme = $this->fetcher->get_check( $args[0] );

		$errors = $theme->errors();
		if ( is_wp_error( $errors ) ) {
			$message = $errors->get_error_message();
			WP_CLI::error( $message );
		}

		$name = $theme->get( 'Name' );

		if ( 'active' === $this->get_status( $theme ) ) {
			WP_CLI::warning( "The '$name' theme is already active." );
			return;
		}

		if ( $theme->get_stylesheet() !== $theme->get_template() && ! $this->fetcher->get( $theme->get_template() ) ) {
			WP_CLI::error( "The '{$theme->get_stylesheet()}' theme cannot be activated without its parent, '{$theme->get_template()}'." );
		}

		switch_theme( $theme->get_template(), $theme->get_stylesheet() );

		if ( $this->is_active_theme( $theme ) ) {
			WP_CLI::success( "Switched to '$name' theme." );
		} else {
			WP_CLI::error( "Could not switch to '$name' theme." );
		}
	}
public function activate ( $ args = array ( ) ) { $ theme = $ this -> fetcher -> get_check ( $ args [ 0 ] ) ; $ errors = $ theme -> errors ( ) ; if ( is_wp_error ( $ errors ) ) { $ message = $ errors -> get_error_message ( ) ; WP_CLI :: error ( $ message ) ; } $ name = $ theme -> get ( 'Name' ) ; if ( 'active' === $ this -> get_status ( $ theme ) ) { WP_CLI :: warning ( "The '$name' theme is already active." ) ; return ; } if ( $ theme -> get_stylesheet ( ) !== $ theme -> get_template ( ) && ! $ this -> fetcher -> get ( $ theme -> get_template ( ) ) ) { WP_CLI :: error ( "The '{$theme->get_stylesheet()}' theme cannot be activated without its parent, '{$theme->get_template()}'." ) ; } switch_theme ( $ theme -> get_template ( ) , $ theme -> get_stylesheet ( ) ) ; if ( $ this -> is_active_theme ( $ theme ) ) { WP_CLI :: success ( "Switched to '$name' theme." ) ; } else { WP_CLI :: error ( "Could not switch to '$name' theme." ) ; } }
Activates a theme.

## OPTIONS

<theme>
: The theme to activate.

## EXAMPLES

$ wp theme activate twentysixteen
Success: Switched to 'Twenty Sixteen' theme.
Activates a theme .