Last active
January 31, 2016 08:42
-
-
Save simofacc/a604d7cd0659493c95f0 to your computer and use it in GitHub Desktop.
Drupal 7 – Enable a theme from a custom module via code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mymodule_init() | |
{ | |
$themes = list_themes(); //Get all the available themes | |
if ($themes['mythemename']->status == 0) { | |
//if mythemename status is 0 i.e. disabled | |
theme_enable(array( | |
'mythemename' | |
)); //enable theme | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment