I can create my theme without splitting it into separate files. Why do theme developers split WordPress theme into a few single files like header.php sidebar.php and etc?
|
You need that for child themes. If you have a separate Another reason is readability: Putting all the code for a theme into just one file gets very messy very fast. A use case for a compact theme is testing and debugging: My Mini Theme uses just |
||||
|
|
|
Regardless of the platform (WordPress, Joomla!, Drupal) or the language (PHP, C++, VB) it's pretty much accepted/standard practice to break out code in to functional units. This includes not only functions and classes, but files as well. As @Toscho points out:
It also makes it easier to:
The list could go on for a very long time. |
|||
|
|
|
Both @toscho's and @stephen's answers good answers, and I upvoted them, but also remember that WordPress looks for particular template files depending upon context. For example, a file named |
|||