Why not open and close html/body in index.php file
-
I’m a developer but new to developing themes for WordPress (though I used it before just as a CMS). I’ve trying searching for an explanation to this on Google and the WordPress forums but haven’t been able to find an answer. It seems that most WordPress themes open the html tag, define the doctype, and open the body in the header.php file and then close these tags in the footer.php. That seems strange and counter intuitive to me compared to having these tags in the index.php file. It’s even more confusing because the first div within the body is in the index.php file. The body tag and its immediate content become separated from one another.
It makes more sense to me to have the index.php both open and close the html and body tags. You would then include the calls for the head, header, and footer within this skeleton.
So my question: is there a reason that the WordPress was designed this way to have the html and body tags opened and closed in two separate files, neither of which are index.php? Is there some benefit or advantage to doing it this way rather than having it all in the index file? I cannot see a reason, and it seems to me that it makes everything more complicated.
Much appreciated in advanced.
- The topic ‘Why not open and close html/body in index.php file’ is closed to new replies.