我用代码创建了插件:
function fxn($theme) {
if(isset($_POST[\'zmien\'])){
$theme = \'loose\';}
else{
$theme = \'twentytwenty\';}
return $theme;
}
add_filter(\'template\', \'fxn\');
add_filter(\'option_template\', \'fxn\');
add_filter(\'option_stylesheet\', \'fxn\');
我找到了代码并将其改编为我的网站。我已经创建了这个插件,它只能部分工作。当我单击按钮时,模板会更改,但当我单击新模板上的任何元素时,页面会返回到以前的模板。如何在浏览页面结束之前更改模板?