I must be thick, but I could use some help grasping the way template files are chosen to be used. I noticed loop.php is no longer around, and looking at the file structure for twentytwelve there is now a 'page-templates' directory. As well as content-* files. We have index.php, page.php, content.php which one is used when? I know index.php is the "last resort" choice, however does content or page come first? And what is the difference between them? Thank you.

  • Have you looked at the graphic in the codex: codex.wordpress.org/… content.php is likely a template part. Commented Sep 29, 2012 at 20:04
  • Yeah I have checked that out, somehow it confuses me. I am certain I am over-analyzing this somehow lol ;)
    – thatryan
    Commented Sep 29, 2012 at 20:14

1 Answer 1


Template hierarchy consist of templates, but not every template file is necessarily in hierarchy.

Essentially hierarchy determines entry points (one of matching templates with pre-defined name structure), but from there template can further load additional arbitrary files.

page-templates directory holds custom templates for pages (is_page() branch in hierarchy). It's recent development that they can now reside in sub-folder.

content-*.php templates are called by Twenty Twelve like this from other templates: get_template_part( 'content', get_post_format() );. They are named arbitrarily and not part of template hierarchy - just a code organization choice that developers of this specific theme made.


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.