【发布时间】:2018-04-13 06:29:52
【问题描述】:
我正在为 wordpress 主题创建一个插件,该插件将模板加载到自己的目录中,而不是将模板放在主题中,这使我能够独立地将模板包含在主题中,因为我创建了短代码来根据条件加载不同的模板。下面是代码:
add_shortcode('template', 'add_template');
函数 add_template($atts) {
提取(简码_atts(数组( '模板' => ''
), $atts ) );开关($模板){
case 'template1': include 'templates/template1.php'; break; case 'template2': include 'templates/template2.php'; break; default: include 'templates/template1.php'; break; } }
我的问题是在某些主题中我的插件开始在管理面板中显示页面我做错了什么吗?请帮忙....
【问题讨论】: