Context
I’ve seen this a lot, but most recently in the TinyMCE code, where the theme is in charge of outputting whatever the end user sees. Switching themes can be painful because some themes add functionality or styling that ties the content to it.
There are conventions that the theme “must call wp_head()
and wp_footer()
” or some things won’t work.
I think the theme should be more limited.
Possible implementation
There could be a filter for the type of output, that defaults to HTML. The core code would have the skeleton to output, filtering the attributes of <html>
and <body>
, and firing actions for each section like we already have for wp_head
and wp_footer
, but add wp_body_open
where the template loader would be. That means template files would not include anything but body content. The filter for the attributes would be a core function to be used for all major content areas, or have a core function that the theme calls to get output filtered. (needs design)
Will you be able to help with the implementation?
Yes, I have already written a way this could work, and use the attribute filter function in my theme (which has been working for 3 years).