How to have my page templates in sub folder Wordpr

2019-07-04 06:13发布

I am using a child theme. In the child theme I would like to have a subfolder for all my page templates, e.g. homepage-template, default-template, etc in /templates. How can I do this so that wordpress admin menu can still see them when I choose a template for a page?

标签: wordpress
2条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-07-04 06:40

Can you upgrade to WordPress 3.4? This is a native function of 3.4.

See: http://nacin.com/2012/03/29/page-templates-in-subdirectories-new-in-wordpress-3-4/

查看更多
何必那么认真
3楼-- · 2019-07-04 06:40

Create a folder with the name page-templates in your theme folder. If you have already published pages with templates before having them under this sub-folder, you have to reselect the template page for these pages and click update.

查看更多
登录 后发表回答