7

I tried drush disable theme-name and afterwards drush enable theme-name, but it didn't work.

How do you change theme with Drush?

10

Commands to be used in theme using drush :

theme-enable        => pm-enable
theme-disable       => pm-disable
theme-info          => pm-info
theme-list          => pm-list --type=theme
theme-list-enabled  => pm-list --type=theme --status=enabled
theme-set-default   => vset theme_default
theme-set-admin     => vset admin_theme
theme-status        => status theme
| improve this answer | |
  • 2
    This only applies to Drupal 6 and 7. – Gogowitsch Oct 3 '17 at 11:04
  • 1
    I didn't find this worked, I had to then also do this: drush vset theme_default THEMENAME and because I had errors relating to my theme not being active, I couldn't access the set default through the admin pages (article I read here: pixelthis.gr/blog/drush-enable-theme-and-set-default) – ja_him Sep 18 '18 at 15:07
10

For Drush 9.5.2 and Drupal 8.6.5 I use the following:

drush theme:uninstall THEME_MACHINE_NAME
drush theme:enable THEME_MACHINE_NAME
drush config-set system.theme default THEME_MACHINE_NAME
| improve this answer | |
  • 2
    Best answer. And if you want to set the admin theme, you can replace "default" with "admin" in the third line. – Kelley Curry Feb 3 at 21:29
1

With Drush 7 and 8, it is no longer necessary to be so verbose. If you want to enable a theme use the alias:

drush en your-theme-name
drush dis your-theme-name

For example:

drush en seven
drush dis bartik

You may want to clear your caches after enabling or disabling themes. For more information please see: DrushCommands.com

| improve this answer | |
  • 2
    For a theme, it is usually not enough to just enable it. You also have to set it as a default. In Drupal 8, the command is this: drush config-set system.theme default NAME_OF_YOUR_THEME – Gogowitsch Oct 3 '17 at 11:04
  • 1
    The question is how to change the theme. If there is already a default, you can't change it until you can set another one as default, and this does not answer that. – Christia Apr 28 '19 at 8:49
-1

drush dis or drush disable is not valid in Drupal 8 anymoreb And it's equivalents in Drupal 8 is

drush pm-unistall THEME_MACHINE_NAME
drush pm-unistall MODULE_MACHINE_NAME
| improve this answer | |
  • 1
    This won't work on a theme set as default. – Christia Apr 28 '19 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy