插件目录中的文件是否可以用作自定义页面模板?
另外,如何使插件创建页面?
我正在为一个基于主题的客户开发一个插件,他希望这个插件能够制作销售页面,同时能够在主页上使用他的主题.这是我正在为他推向市场的产品,所以它需要通过插件实现自动化.
这可能吗?
编辑
我的插件主文件中有激活/取消激活挂钩,但它无法正常工作.这是代码:
$filename = __FILE__;
register_activation_hook($filename, 'superActivation');
register_deactivation_hook($filename, 'superDeactivation');
global $myFile; global $fh; global $stringData; global $filename;
$myFile = "testFile.txt";
$stringData = "Testing\n";
$fh = fopen($myFile, 'w') or die("can't open file");
function superActivation() {
global $myFile; global $fh; global $stringData; global $filename;
fwrite($fh, $stringData);
fclose($fh);
}
function superDeactivation() {
$myFile = "testFile.txt";
unlink($myFile);
}
Run Code Online (Sandbox Code Playgroud) wordpress ×1