WordPress Template Hierarchy Explained
This post attempts to give anyone wanting to learn the basics of WordPress a good start. In order to be able to successfully use the full potential of WordPress as a Content Management System it is essential to understand how to create a file structure for posts, pages, categories, tags, taxonomies of other kinds and more.
Home
- home.php
- index.php
Single Posts
- single-{posttype}.php
- single.php
- index.php
Pages
- {pagename}.php (custom template)
- page-{slug}.php
- page-{id}.php
- page.php
- index.php
Category
- category-{slug}.php
- category-{id}.php
- category.php
- archive.php
- index.php
Taxonomy
- taxonomy-{taxonomy}-{term}.php
- taxonomy-{taxonomy}.php
- taxonomy.php
- archive.php
- index.php
Tag
- tag-{slug}.php
- tag-{id}.php
- tag.php
- archive.php
- index.php
Date
- date.php
- archive.php
- index.php
Archive
- archive.php
- index.php
Attachment
- {MIME_type}.php (text.php, image.php, audio.php, video.php)
- attachment.php
- single.php
- index.php
Author
- author-{nicename}.php
- author-{id}.php
- author.php
- archive.php
- index.php
Search
- search.php
- index.php
404
- 404.php
- index.php
Graphics and info taken from the WordPress codex.







