示例站点(mysite.com
)和使用wordpress定义为mysite.com/mypage
的页面
本页经过模板page-mypage.php
。现在,当我运行mysite.com/mypage/somechild
,其中somechild
页没有与wordpress定义。这将导致未找到错误(404)。
如何使mysite.com/mypage/*/*
通过模板page-mypage.php
?
wordpress不是slug基础模板,请检查
https://developer.wordpress.org/files/2014/10/template-hierarchy.png假设您有一个名为mypage的页面,它将使用if exists
custom-template-you-define.php //if doesn't exist it will look for
page-[slug].php // if doesn't exist it will look for
page-[id].php // if doesn't exist it will look for
page.php // if doesn't exist it will look for
singular.php //if doesn't exist it will look for
index.php //if doesn't exist White Screen
您也必须为子页面选择相同的页面模板。