[wp-hackers] Mille viae ducunt homines per saecula index.php

Otto otto at ottodestruct.com
Wed Apr 17 13:40:22 UTC 2013


On Tue, Apr 16, 2013 at 9:02 PM, Micky Hulse <mickyhulse.lists at gmail.com> wrote:
> A part of me was thinking that using fewer, or just one, template(s),
> but more conditional logic with sub-template includes, would be
> (possibly) easier.

This is not an uncommon line of thinking, but it is a very
programmer-oriented approach. Programmers understand if-statements and
conditionals just fine, and so this approach where they
don't-repeat-themselves in terms of duplicated code appeals to them.

The thing is that normal people are far more comfortable with having
separate files to do separate tasks, and have no problems with
repeating themselves. Endlessly, sometimes. Watch somebody who does a
lot of document or spreadsheet work on a regular basis and see how
they handle it. Lots of copy-pasta going on there.

In my opinion, themes should use separate template files whenever
possible, simply because separation of sections is easier to
understand for the non-programmer. It's easier to show somebody a site
in "parts" and then show them which files control which parts than to
have to try to explain PHP embedding in HTML, branching, conditional
logic, and all those concepts. And yes, end-users are the ones that
are going to be editing their themes, like it or not. If they want to
make minor customizations in wording, or layout, or they want to do
the latest SEO-trick-of-the-week, then they're eventually going to
want to screw with the HTML directly. Best to make that easier.

Also, consider child-themes. Much easier to do if you have lots of
separate templates.

-Otto


More information about the wp-hackers mailing list