WordPress Template hierarchy
From Wiki @ Karl Jones dot com
In WordPress, the Template hierarchy is the hierarchal relationship between WordPress Templates.
The hierarchy determines which Templates is used to display a particular set of content.
Description
Every Theme must have a Template file named index.php
.
Most Themes use additional Template files which take precedence over index.php
.
Commonly used Template files include:
-
single.php
-
page.php
-
category.php
Categories
In the case of categories, the hierarchy is fairly simple. For instance, suppose the slug of the Category in question is news and the Category ID is 6. The Template Hierarchy specifies that WordPress will use the first Template file it finds in your current Theme's directory from the following list:
-
category-slug.php
-
category-ID.php
-
category.php
-
archive.php
-
index.php
See also
External links
- Template Hierarchy @ developer.wordpress.org
- Template hierarchy diagram @ wphierarchy.com