diff --git a/includes/common.inc b/includes/common.inc index cfa48aa9d26b287e8761ed1c0ca41dd7ea793609..f3abbac85a521512640cc1c5324307b930b97140 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -1905,7 +1905,4 @@ function clone($object) { // Initialize the localization system. $locale = locale_initialize(); -// Initialize the enabled theme. -$theme = init_theme(); - ?> diff --git a/includes/theme.inc b/includes/theme.inc index 11004306ba07818e98a6d25de40739a5a2bbab9d..14b2181e3040207dbd6ede0336f1beb96291aa6b 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -171,8 +171,12 @@ function list_theme_engines($refresh = FALSE) { * An HTML string that generates the themed output. */ function theme() { - global $theme; - global $theme_engine; + global $theme, $theme_engine; + + if (!$theme) { + // Initialize the enabled theme. + $theme = init_theme(); + } $args = func_get_args(); $function = array_shift($args);