5 Ways To Include Template Files In WordPress
As long as you work with WordPress, you’ll realize that some code is repeated itself many times, like the loop. The new Twenty Ten theme in WordPress 3.0 has put loop code in into a loop.php file to make it separated, and when it’s needed, just include it into theme file. Why don’t we follow that? Separating a repeatitive code into a file is a good way to organize and manage code. It keeps our code cleaner, easier to read. All these files can be put in a current theme folder or subfolder to make a good structure. This is a very popular principle in software development: Don’t Repeat Yourself (DRY) or Duplication is Evil (DIE). In WordPress, there are several ways to include a template file into current file, that we’ll consider in this article.