-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
What problem does this address?
During a test of experimental FSE theme Proto we found that content from Better Docs plugin was rendered without our custom header and footer. The cause is that like many plugins it ships a page template that uses get_header() and get_footer(). These calls try to find header.php and footer.php and when the theme does not provide them it load a WP Core template header and footer. Instead we should add a mapping so that when the theme is determined to be FSE, the search is done for header.html under /block-template-parts. If a default header.html and footer.html is not found, only then should WP load a core template. Loading a core template is generally still needed because without it sites break due to no script loading.
What is your proposed solution?
Rework the template locate functionality in core so that it detects FSE and searches for header.html and footer.html under block-template-parts/ in the FSE theme. If found, load them in place of the PHP versions.
Although automatic detection seems sensible and mirrors the current approach where themes can expect header.php to be automatically loaded during a get_header call, there is also with FSE themes the possibility of defining a default header in theme.json. This doesn't seem entirely useful to me, but it would allow someone to define "header-sticky.html" as their default rather than swapping the content from a header-sticky.html into header.html. In the event of switching themes or portability of template perhaps that would be a benefit. I still think default function should mirror the header and footer autoloading currently done for classic themes.