• WordPress Template Hierarchy Diagram

    If you’ve ever developed a WordPress theme, you’re (hopefully) familiar with the Template Hierarchy and how the WordPress template files fit together like a puzzle.

    With WordPress, you have pages that display the content you put on those pages. To style the content on these pages, we use different files in a WordPress theme (duh). But which files are assigned to which pages? That’s where the Template Hierarchy comes in. Depending on what templates are available in the theme, different files will be assigned to certain pages.

    “WordPress looks for template files with specific names in the current Theme’s directory and uses the first matching template file listed under the appropriate query section below.” – WordPress Codex

    Anyways, there’s no better way to understand the WordPress Template Hierarchy than to see it visually. If you’ve ever gone over to the Template Hierarchy page of the WordPress Codex and scrolled down a bit, you will notice a Template Hierarchy visual which basically explains how the template hierarchy works.

    No offense, but this visual isn’t the most appealing. Sure, it gets the message across, somewhat clearly, but a little bit of eye candy wouldn’t hurt, right? So I’ve made a little something for you guys.

    Now, I can’t take credit for coming up with the actual structure of the diagram, I simply redesigned the existing one, in hopes of more people using it and learning from it. So with that said, if you’re learning to develop WordPress themes, make sure you know how the WordPress Template Hierarchy functions!

    Post Revisions:

    Posted April 12, 2008

13 comments

  1. Lewis said:

    Nice, Much more appealing to use and I will actually read it now :) Keep up the good work.

    on April 12, 2008 at 12:01 pm Reply

  2. Luke said:

    Perfect. Will be using this as I code WordPress alot. Looks really nice as well. Thanks! :)

    on April 12, 2008 at 12:05 pm Reply

  3. Joshua Goodwin said:

    Snazzy. You should put this on the WordPress codex to replace the current yuckier one.

    on April 12, 2008 at 12:05 pm Reply

  4. zinni said:

    What a great resource, thanks for taking the time to make it!

    on April 12, 2008 at 2:32 pm Reply

  5. Michael Cromarty said:

    Looks much better Mike ;)

    Nice idea.

    on April 12, 2008 at 4:53 pm Reply

  6. Brady Valentino said:

    I’ve never used the hierarchy diagram before, but looking at your’s it’s way better than the one that the WordPress dev team came up with.

    on April 12, 2008 at 8:37 pm Reply

  7. CincauHangus said:

    very simple and nice! one question though.. is there a category-6.php file or category-6.php is specific to that cat-id=6?

    on April 13, 2008 at 2:10 pm Reply

  8. Jimmy G said:

    Nice one Mike – handy to have around :D

    Looks very “Help Sheet” like may I add? ;-)

    Keep up the good work.

    on April 13, 2008 at 7:47 pm Reply

  9. Doug said:

    Definitely a visual improvement over the original, which was always useful. But like the original, this one still doesn’t include the Attachment page hierarchy.

    Personally, I think all those “if doesn’t exist” lines are distracting, but I guess the diagram would be confusing to newcomers without them.

    Good work overall!

    on April 14, 2008 at 11:14 am Reply

  10. Cobus Bester said:

    Nice one! I’m printing this and keeping it close by for reference as I code.

    Thank you for taking the time to create a helpful resource!

    Keep rocking :)

    on April 21, 2008 at 6:31 am Reply

  11. Benji said:

    What about the attachment template? some are missing but really helpful.

    on May 1, 2008 at 1:33 pm Reply

  12. Omkar said:

    Is this same for WordPress 2.5 also??? Thanks.

    on May 9, 2008 at 6:33 am Reply

  13. Omar Dolaimy said:

    Thanks :) .. This helps alot!

    on March 26, 2009 at 12:44 pm Reply


RSS feed for comments on this post.

Leave a comment

Trackbacks on this post

  1. Die Wordpress Template Hierarchie

    [...] aufruft und was passiert, wenn das entsprechende Template nicht vorhanden ist, für den gibt es hier bei WPCandy eine übersichtliche Grafik. Das ganze ist eigentlich hier schon bestens beschrieben und es hat [...]

  2. élet és könyvtár » Blog Archive » Vasárnap reggeli WordPress és dizájn linkek

    [...] első a WPCandy pofás Template Hierarchy ábrája (a WP működési struktúrája gyakorlatilag), amely a [...]

  3. WordPress Weekly News, 15-2008: security and much more

    [...] a useful diagram that shows the hierarchy of a WordPress [...]

  4. Ultime dal fronte WordPress 16-2008: Sicurezza ed altro

    [...] un interessante diagramma che mostra la corrispondenza tra le pagine del blog ed i files del template, molto utile per i [...]

  5. WP Template Hierarchie « awakening

    [...] arbeitet WordPress eigentlich? Die Grafik von Michael Castilla zeigt ein schöneres, schwarzweiss Diagramm als der eigentliche Grafik auf der Codex Seite von [...]

  6. links for 2008-04-26

    [...] WordPress Template Hierarchy Diagram A must for would-be WP designers. (tags: WordPress templates hierarchy diagram) [...]

  7. NETTUTS - Web development tutorials and links - Best of the Web - April

    [...] Visit Article [...]

  8. Best of Avril 2008 : le meilleur des liens et ressources

    [...] La hiérarchie des templates WordPress en une seule image ! Très pratique ! [...]

  9. » Cheat Sheet: WordPress Template Hierarchie » BlogPimp

    [...] WordPress Template Hierarchy Diagram geschrieben am 02.05.08 um 01:56 Uhr von: BlogPimp [...]

  10. Jerarquía de Plantillas en imágenes | Ayuda WordPress

    [...] En WP-Candy han elaborado una imagen de ejemplo que ilustra perfectamente la jerarquía de los archivos dentro de una plantilla de WordPress. [...]

  11. Skylog » Blog Archive » links for 2008-05-03

    [...] WordPress Template Hierarchy Diagram (tags: wordpress) [...]

  12. WP Template Hierarchy diagram

    [...] and how the WordPress template files fit together like a puzzle… Might come in handy Click here to visit >> No Comments, Comment or [...]

  13. Resources for the uninspired or busy Web DesignerSoIt’s « Web Design for the Civil Defense Bar
  14. 5 Ideas para hacer temas ágiles en WordPress | Dupermag

    [...] Si quieres saber como funciona la jerarquía de páginas en WordPress, mira este diagrama. [...]

  15. Wordpress Template Hierarchy Diagram ht… « wordpressmaster tutorial

TrackBack URL