I'm trying to load a child theme when on certain posts, pages or categories with the code below. It loads the child theme's css just fine, however, the child themes' template files don't load.
If I explicitly set the child theme via the Appearance setting in WP 2.7 everything works as expected. What am I doing wrong or not doing that I should do?
function mp_get_theme() {
global $wp_query;
$post = $wp_query->post;
$id = $post->ID;
// should I load another theme?
if ($post->ID == 836 || $post->post_parent == 836 || (is_archive() && is_category('14')) || (is_single() && in_category('14')))
{
return 'newtheme';
}else{
return 'defaulttheme';
}
}
add_filter('template', 'mp_get_theme');
add_filter('stylesheet', 'mp_get_theme');