#33309 closed enhancement (duplicate)
Add support to add page template via theme_page_templates filter
Reported by: | prionkor | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
theme_page_templates
(https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-wp-theme.php#L1022) does not currently allow for page templates to be added.
I am wondering is there any good reason for that? Not allowing additional template to be added beats the purpose of the filter.
Can we have the filter ability to add page templates?
Change History (2)
#1
@
9 years ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
- Version 4.2.4 deleted
#2
@
9 years ago
Thanks good read!
simply adding a new page template via that filter wouldn't actually allow the template to be used
I am developing a theme with MVC structure where there is a template factory which take care of the all templating.
The reason I was trying to use this filter want to have user select a (fake) page template. And If selected depending on the template name the template class can choose the right view class for it.
I will add a reply on that ticket.
The filter was designed to allow the renaming & removal of templates from being listed, simply adding a new page template via that filter wouldn't actually allow the template to be used (even if the function was changed to allow it).
See #13265 for a long discussion over being able to add templates via a filter.