Skip to Content

5 Ways To Include Template Files In WordPress

Submitted by • June 30, 2010

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? Seperating 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.

Voted by:
Voted by BenVoted by bpolitschVoted by quicklycode

Visit Site 0 Comments Share

No Responses to “5 Ways To Include Template Files In WordPress” Leave a reply ›

Leave a Reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>