Wordpress 添加自定义页面而不添加模板
Wordpress add custom page without adding template
我的主题文件夹中有一个名为 settings.php 的自定义页面,我不想将其用作页面模板。
如何保留 URL 让我们称之为我的站点。com/settings,这样 url 会为我加载 settings.php 页面?
创建一个名为 'settings' 的新页面。并将此代码添加到您的 functions.php
if(strpos($_SERVER['REQUEST_URI'],'/settings') !== false){
include(get_template_directory(). '/settings.php');
}
我的主题文件夹中有一个名为 settings.php 的自定义页面,我不想将其用作页面模板。
如何保留 URL 让我们称之为我的站点。com/settings,这样 url 会为我加载 settings.php 页面?
创建一个名为 'settings' 的新页面。并将此代码添加到您的 functions.php
if(strpos($_SERVER['REQUEST_URI'],'/settings') !== false){
include(get_template_directory(). '/settings.php');
}