Why are we forced to use checked() and get_header() for themes?
-
For checkboxes
The problem with checked () is that it only matches a string against a string, so for an array of checkboxes we have to use a foreach loop instead of if(in_array). So it doesn’t actually simplify anything at all in those circumstances.
Perhaps checked() could include a parameter for multiple checkboxes by using in_array in the function.get_header(), get_footer(), get_sidebar()
The problem with these are that they’re functions. Include() was SOO much simpler and nicer. But now with these functions we have to figure out what variables aren’t going through them because otherwise the theme doesn’t work e.g. when using options stored in a global array.
In other words they’re extra work and where’s the benefit? Nothing about this in the relevant functions codex, either, so it’s a case of hunting around to find out what the problem is.
https://old.nabble.com/get_header-vs-include-header.php-td6548537.htmlThere are strict rules on submitting themes for the repository, but some of those rules seem to be bordering on the anal. What’s wrong with include()? Why are we required to use checked ()? They don’t do much except make the code look a little prettier, and they add in extra work and IMO often reduce clarity and simplicity.
- The topic ‘Why are we forced to use checked() and get_header() for themes?’ is closed to new replies.