在 WordPress 中使用 PHP 手动设置模板 [英] Manually set template using PHP in WordPress
问题描述
我正在设计一个新模板来替换现有模板.该模板名为 features.php,我将用 features-new.php 替换它
I'm designing a new template to replace an existing one. The template is called featured.php and I'm going to be replacing it with featured-new.php
我想在查询字符串中传递变量new",然后如果 new
变量存在,它将使用 features-new.php 文件.
I want to pass the variable "new" in the querystring, then if the new
variable is present it'll using the featured-new.php file.
我该怎么做?是否有标签告诉页面使用指定的模板?
How can I do this? Is there a tag to tell a page to use a specified template?
推荐答案
我会使用 theme switcher
插件,例如 one,然后自定义是仅从 URL 显示它还是打开布局.
I would use theme switcher
plugins such as this one, then customize whether present it only from URL or switch on the layout.
另外,看看这个:主题切换
这篇关于在 WordPress 中使用 PHP 手动设置模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!