使用插件。钩入after_setup_theme 并检查当前主题是否为正确的子主题:
add_action( \'after_setup_theme\', \'common_child_theme_functions\' );
function common_child_theme_functions()
{
if ( \'Twenty Twelve\' !== wp_get_theme()->parent() )
return;
// do your work
}
wp_get_theme() 返回a
WP_Theme 实例,以及
parent() 父主题名称或
FALSE.
我不推荐mu插件。真正的插件可以停用,您可以分别为每个站点启用或禁用它们。调整客户的能力;这是一种更干净的方法。