I'm studying TwentyTen, under the assumption that it contains the best practices for writing themes and modifying them using child themes.

I'm noticing what looks like a really redundant practice, which is to overload not the base template file (eg: attachment.php) but instead to overload the template-part file (eg: loop-attachment.php).

Can someone explain the benefit of this approach? If you look at attachment.php, for example, inside TwentyTen, it's really nothing more than a shell - gets header, creates some divs, then calls the REAL attachment file using get_template_part - then displays the footer.

And then if you look at single.php, it's almost exactly the same deal.

I can understand wanting to define an outer structure once, and then using different parts of the loop as internals, but that's not what TwentyTen is doing, since it redefines this outer structure over and over in all these different template files.

Can someone either confirm that the approach taken in TwentyTen is overkill and just obfuscates theme overloading, or point me to some good examples where this technique can actually make your life easier. Right now I'm feeling I should ignore the whole get_template_part thing, and just overload the base template file.


2 Answers 2


TwentyTen was designed to help understand the WordPress theming system and that is why it has more lines of comments then actual code. So looking at TwentyTen you need to understand that they tried to include every file in the Template Hierarchy (eg: attachment.php, single.php, page.php) and every template tag there is (including: get_template_part() which is relatively new).

The best practices would be to use as much theme files and template parts as you can if the theme you are designing / developing is to distributed to make the life of the people who use it as easy as possible in customizing it for there needs, but if its just for your own use then a single index.php with 3-4 template parts would be fine if you know what you are doing.

For example I've recently had a client that wanted to use EvoLve theme which is a beautifully designed but very badly developed. I needed to create custom templates for a custom post type and i can tell you that the it wasn't nice at all and i had to do some major reverse engineering to get it done.

but then again it depends on what you like to do with the theme (share or self use) and even then its up to you.

  • This is good info, and I hear you about dealing with badly-built themes. It's a real crapshoot out there.
    – Tom Auger
    Apr 30, 2011 at 14:40

I am afraid you are not likely to get definitive answer on this one. Some people like this type of organization, some hate it.

There are two sides to parent/child theme design - to rely on templates or on hooks. Obviously any theme makes use of both, but Twenty Ten is very heavily slanted towards templates.

Myself I am much more inclined to use hooks approach, so my parent theme of choice is Hybrid.

I think you do not need to feel forced to follow Twenty Ten design patterns. It's official, but it isn't ideal or only-true-way kind of theme.

  • Thanks, Rarst. You make me feel better about not following every single convention outlined in TwentyTen. Like Bainternet's response, it sounds like TwentyTen is almost over-designed just to show you what's possible.
    – Tom Auger
    May 6, 2011 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.