List of Template files in Themes

The following files have special meaning to WordPress. We can have more files apart from these files.

The main stylesheet. This must be included with your Theme, and it must contain the information header for your Theme.

Example of information header :

Theme Name: My Theme
Theme URI: the-theme’s-homepage
Description: a-brief-description
Author: your-name
Author URI: your-URI
Template: use-this-to-define-a-parent-theme–optional
Version: a-number–optional
General comments/License Statement if any.
The main template. If your Theme provides its own templates, index.php must be present.


The comments template. If not present, comments.php from the “default” Theme is used.
The popup comments template. If not present, comments-popup.php from the “default” Theme is used.
The home page template.
The single post template. Used when a single post is queried. For this and all other query templates, index.php is used if the query template is not present.
The page template. Used when an individual Page is queried.
The category template. Used when a category is queried.
The author template. Used when an author is queried.
The date/time template. Used when a date or time is queried. Year, month, day, hour, minute, second.
The archive template. Used when a category, author, or date is queried. Note that this template will be overridden by category.php, author.php, and date.php for their respective query types.
The search results template. Used when a search is performed.
The 404 Not Found template. Used when WordPress cannot find a post or page that matches the query.

These files have a special meaning with regard to WordPress because they are used as a replacement for index.php, when available, according to the Template Hierarchy, and when the corresponding Conditional Tag (a.k.a is_*(); function) returns true. For example, if only a single post is being displayed, the is_single() function returns ‘true’, and, if there is a single.php file in the active Theme, that template is used to generate the page.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: