Friday, October 7, 2011

Changing Theme with Init Hook

If you need to actually change a theme, you need to write the following in a module's init hook:

function yourmodule_init() {
global $custom_theme, $theme;

//... some logic ...

$theme = null;
$custom_theme = 'chameleon'; // 'chameleon' being the theme you want to set

}

No comments:

Post a Comment