Like the blog? Get the book »

Which Template File does WordPress Use to Render Different Pages?

Which Template File does WordPress Use to Render Different Pages?

This page in the codex has a particularly interesting infographic that shows a flowchart of how WordPress chooses which template file it is going to use to render the page. For example, did you know if you have a published page with "contact" as the slug, it will look for and use page-contact.php automatically?

Unfortunately this graphic wasn't very pretty and for some reason has a giant "Page 1" text awkward sitting over it. We have an outdated version of this in the book, and since we are updating it right now, I thought I would take the opportunity to re-create this chart.

WordPress Template HierarchyClick here for full-size version

This will also be used in the book, which should be back available for order in around a week or so! Stay tuned!

11 responses

  1. I thought there were more stuff with authors, a bit like tags or categories ?

  2. I’m interested in where custom taxonomies and the 3.0 custom post-types will fit in.. Any happen to know off hand?

  3. It may not be perfect, but I really appreciate your sharing this. I’m not an expert at editing theme files, and this will help.

  4. In WP 3.0 I’m using single-contact.php for a custom post type “contact”.

    Thanks for the redesign, this is much easier on the eyes than the Codex’s version.

  5. Glad to hear its in the book and that the book will be back on sale soon. Looking forward to getting my mitts on it! :)

  6. you forgot the PAGE-{ID}.php.

Comments are closed for this post. Contact us with any critical information.
Advertise Here

Sign up for the newsletter!

Never spam, only good stuff

Recent posts

Loading...

Random posts

Loading...
© 2009–2017 Digging Into WordPress Powered by WordPress Monzilla Media shapeSpace