我将此代码添加到我的函数文件中,因此根据插件是否被激活,有不同的主题选项。
function theme_options_select() {
if( is_plugin_active( \'gallery-nails/gallery-nails.php\' )) {
require get_template_directory() . \'/inc/theme-options/nails/theme-options.php\';
}
else {
require get_template_directory() . \'/inc/theme-options/default/theme-options.php\';
}
}
add_action( \'wp_loaded\', \'theme_options_select\' );
我尝试了plugin\\u loaded和setup\\u theme,但主题选项无法访问。init也可以工作,但也会中断登录。
有人知道怎么解决这个问题吗?