[theme-reviewers] CSS3 Validation ?

Otto otto at ottodestruct.com
Tue Jul 26 15:54:31 UTC 2011


On Tue, Jul 26, 2011 at 6:51 AM, Chip Bennett <chip at chipbennett.net> wrote:
> If you're including a template-part file, i.e. a file that is intended to be
> used as part of rendering the output, then you should be using
> get_template_part(). If the template part file is in a subdirectory, then
> you should be using locate_template().
> If you're including a functional file (generally speaking, anything included
> inside of functions.php), then you should be using include() or require(),
> as appropriate. (Though it's probably *okay* to use locate_template() in
> this context; I'm not sure what benefit there would be.)

Basically correct. I added the warning about includes/requires to the
theme check primarily to tell people to use the template functions.
It's certainly not a *requirement* of any sort. I just wanted themes
to get more friendly towards child theming.

If you're loading something that displays just a section of output of
the theme (like the loop, or a content piece, or a post format, or
whatever), get_template_part is the right way. Note that "parts"
shouldn't be aggregated into a subdirectory because of the way
get_template_part works.

If you're loading a whole template or anything else that a child theme
might want to override, locate_template is the right way.

If you're just including code to be used elsewhere, like a PHP library
or something, then include/require is the right way. Using
locate_template here would work equally well and would allow a child
theme to override this library. Whether this has benefits or not
depends on the code in question.

-Otto


More information about the theme-reviewers mailing list