roots/sage

header.php and footer.php templates are required in themes

rob006 opened this issue · 7 comments

As far as I can't find any explicit declaration of requiring header.php and footer.php in documentation, it looks like that files are required. wp-signup.php and wp-activate.php (which are used for creating and activating accounts in WP Network) use old-style theming and call get_header() and get_footer().
https://github.com/WordPress/WordPress/blob/master/wp-includes/general-template.php#L22
If theme does not have header.php or footer.php, templates from /wp-includes/theme-compat/ are loaded:
https://github.com/WordPress/WordPress/tree/master/wp-includes/theme-compat
Here you can find 4 templates that are used as fallback and all generate notice like:

Notice: Theme without header.php is deprecated since version 3.0 with no alternative available. Please include a header.php template in your theme.

According to this, all templates should contain header.php, footer.php, comments.php and sidebar.php templates in main theme directory - right now none of them are available in Sage.

#1052 (comment)

right now none of them are available in Sage.

and they won't be — this is a wontfix. add them if you need to for your purposes.

Seriously? What is the point of starter theme for WordPress, if it is broken by default and need special work for make it compatible with build-in WordPress features?

QWp6t commented

You can feel free to take your complaint upstream if you want, but there are already tickets open that could resolve it, one of which has been open for 3 years and another for 6 years.

Once this issue is resolved in WordPress core, I imagine it wouldn't be too much trouble for us to add partials/head.php (Sage 9) or templates/head.php (Sage 8) to get_header(), same goes for the footer and the rest.

Once this issue is resolved in WordPress core, I imagine it wouldn't be too much trouble for us to add partials/head.php (Sage 9) or templates/head.php (Sage 8) to get_header(), same goes for the footer and the rest.

And what is the trouble with creating header.php with get_template_part('templates/head')?

QWp6t commented

Well, you tell me. You're the one who opened this issue because doing that is too much "special work" for you. ¯_(ツ)_/¯

@QWp6t Please... Now I know so header.php is required and I will fix this for my future themes, but so far I created few themes based on Sage and all of them are broken in Network installations, because I don't know that before. There is probably many people like me which don't know that and still creating themes based on Sage, and all of them does not work correct on Network installations. Don't you think so including header.php by default will create more bulletproof starter theme, which will result less broken themes?
When I search starter theme I expect some modern template, which will satisfy all WP requirements, so I can focus on creating themes, not digging WP documentation to find some nuances. I'm disappointed that you know about this issue, and just ignore it because "everyone can fix it by own". Well, every part of theme can be done by theme author, so you can throw out every single Sage feature and say "you can do this by yourself, it is not big problem".

QWp6t commented

I created few themes based on Sage and all of them are broken in Network installations

Omitting header.php doesn't break themes. It simply triggers a notice when WP_DEBUG is enabled. It's not that big of a deal, and you can suppress the notice using WP hooks.

We're not going to add header.php or footer.php to the root of Sage's theme directory. Use a workaround, add the files yourself, or take the issue upstream.

I don't know what else to tell you. As @retlehs said:

this is a wontfix.