theme development – Is there a way to have WordPress autodetect page templates in the page-templates directory and any sub-folders?
Question
I know you can put custom page templates in the page-templates directory and WordPress will automatically detect them and make them selectable from a dropdown in the admin, but I would love to be able to further organize these in sub-directories…for example:
- page-templates
- some-template.php (works fine)
- another-template.php (works fine)
- products (sub-dir)
- product-specific-template.php (not detected by default)
- product-specific-template2.php (not detected by default)
Is there a way to tell WordPress to automatically detect all templates within page-templates and any subdirectories within page-templates ?
0
9 months
2022-09-22T08:21:27-05:00
2022-09-22T08:21:27-05:00 0 Answers
0 views
0
Leave an answer