List of Template files in Themes

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

style.css
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.
.
*/
index.php
The main template. If your Theme provides its own templates, index.php must be present.


comments.php

The comments template. If not present, comments.php from the “default” Theme is used.
comments-popup.php
The popup comments template. If not present, comments-popup.php from the “default” Theme is used.
home.php
The home page template.
single.php
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.
page.php
The page template. Used when an individual Page is queried.
category.php
The category template. Used when a category is queried.
author.php
The author template. Used when an author is queried.
date.php
The date/time template. Used when a date or time is queried. Year, month, day, hour, minute, second.
archive.php
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.
search.php
The search results template. Used when a search is performed.
404.php
The 404 Not Found template. Used when WordPress cannot find a post or page that matches the query.

IMP:
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.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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: