I need to create a plugin that makes custom page templates available in wp-admin. I'm wondering if someone has tackled this already, as it seems like a pretty typical process?
|
|
I'm not entirely sure I understand what you are trying to achieve, at least why you would want a plugin to do that. The normal procedure for creating different page templates is:
... I hope that is what you are trying to achieve? Official documentation here: http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates |
|||||||||||
|
|
This seems to be quite hard to achieve. I think page attributes meta box will need to be forked and completely replaced for this. And not sure it will be possible even then. I agree that this seems like something that makes sense, but WordPress code is very precise in that it wants named templates to only come from theme's directory. |
|||
|
|
|
Like Rarst answered you can really do that without editing core files or remove the page attributes metabox and create your on using the same code with a bit of modification. the code below is the code for the /admin/include/meta-boxes.php and i added the a comment to show where your extra page template options would go:
Don't know if this is a fix in your case but i had a smiler case when i needed to display the post type in a plugin built-in theme and for that i used Another option would be to make your plugin create the template file in the current theme directory , something like this:
and you can run this after you first check if the file exist
Hope one of this helps. |
|||||
|
|
Isn't doing this one of the reasons that http://core.trac.wordpress.org/ticket/10467 At the time it was an issue related to BuddyPress, which wanted to toss in extra templates here and there. I take it they're not properly listed as page templates, though: |
|||
|


