wordpress Post 与 Page 使用同一个模板的方法是什么呢?对于使用wordpress建站的设计师来讲,有时希望 Page 与 Post 共用一套模板,除了需要定制化的 Page 之外。这里分享共用模板的解决方案。
参考 single post 与 single page 遵循的模板名规则顺序可知,使用 singular.php 作为模板名,即可使 Post 与 Page 共用同一个模板。
single Post 的模板名规则顺序
- single-{post-type}-{slug}.php
- single-{post-type}.php
- single.php
- singular.php
- index.php
single Page 的模板名规则顺序
- custom template file
- page-{slug}.php
- page-{id}.php
- page.php
- singular.php
- index.php
这就是 wordpress Post 与 Page 使用同一个模板的方法,怎么样?希望可以帮到以wordpress为核心的北京建站公司!