Looking through functions.php, I see that the pattern is to use function_exists checks everywhere and thus encourage child themers to use the same function names to change functionality. This is a pattern for default themes that dates back to at least twentyten. In the years since the various APIs have matured and I think it might be good to question if this is the pattern that should still be encouraged?
As of now, functions.php and inc/block-patterns.php have a small number of functions and I think that makes it ripe to consider if this is the pattern that is still best. Would removing them and increasing the inline documentation to outline how to make adjustments be a better pattern? Is there another alternative that hasn't been done?
It's possible that additional hooks or extension points may need to be added to core, but I feel that the default themes have long been great drivers at making core better at providing themers with new APIs and thus the end-users of WordPress with better sites.
The text was updated successfully, but these errors were encountered:
Personally, I don't think the duplicate checks make much sense, and I'd be happy to get rid of them. In general I've never felt that re-using function names is a good practice. In most other contexts, you'll do some real damage!
(Also, I guess it's good that the theme is so lightweight that this minor discussion point is what folks keep being drawn to.)
I think clear documentation on how to extend things (and what should be extended) is safer than pluggable functions since as you point out, it's possible to do real damage.
If we want to go down this path, I might suggest that we come up with "recipes" for customization and have those documented and then referenced in line. For example, it's possible that someone's brand is to use a specific serif font and they would want to use that instead of Source Serif Pro. Making it clear how to do that and then above the twentytwentytwo_get_font_face_styles function, there could be a link to that recipe.
Now that we're nearing release, I'm going to close this issue. If anyone has further thoughts to share on this topic, feel free to open up a new issue on Trac.
Looking through functions.php, I see that the pattern is to use function_exists checks everywhere and thus encourage child themers to use the same function names to change functionality. This is a pattern for default themes that dates back to at least twentyten. In the years since the various APIs have matured and I think it might be good to question if this is the pattern that should still be encouraged?
As of now, functions.php and inc/block-patterns.php have a small number of functions and I think that makes it ripe to consider if this is the pattern that is still best. Would removing them and increasing the inline documentation to outline how to make adjustments be a better pattern? Is there another alternative that hasn't been done?
It's possible that additional hooks or extension points may need to be added to core, but I feel that the default themes have long been great drivers at making core better at providing themers with new APIs and thus the end-users of WordPress with better sites.
The text was updated successfully, but these errors were encountered: