add/apend templates ‘transparently’ via plugin to currently active theme or child theme?

Cross posting my trac question here in the slim hopes that someone here has run into the same issue and has already come up with some proof of concept code I can try:

In building a custom ‘theme plugin’ for bbpress I was just made aware that it is impossible for a plugin to ‘transparently’ add/append template files to the currently active theme or child theme.

Read More

I’d like to request the enhancement where when a theme is looking for a custom template such as single-forum.php to search a plugin folder if it is not found in the child theme or parent theme.

I’m thinking of some type of action where my plugin can say ‘add me’ to the list of places you are looking for templates.

If my understanding is correct, when WordPress is looking for a template it starts in the child, then the parent theme but ends there.

Why? If I have a user manually add all of the custom templates needed to their current theme, and they update their theme, they will loose all the templates they manually added.

This means I have no way of giving a user custom theme templates that won’t be lost when upgrading, thus requiring them to manually add the templates back in every time they upgrade their theme.

What it really means for me is that there is no real path for me to create custom bbpress templates for users where I don’t have to worry about them loosing them.

I can go the route that bbpress currently uses in this situation which is that bbpress uses the themes page.php template and replaces the_content(). The problem is I am stuck with whatever is included in the active themes page.php file.

*for instance twentyten has the title hardcoded in and the call to the sidebar, which I can’t remove

I can’t go the child theme route, because I have to assume that they are already using a child theme.

Another dev told me today that this issue came up about 2 years ago. I am praying that there was proof of concept code somewhere that I can try to utilize. Does anyone happen to know if concept code exists anywhere?
strong text

Related posts

Leave a Reply

1 comment