- Page Not Found Template (404.php)
- Archive Template (archive.php)
- Archive Index Template (archives.php)
- Author Page Template (author.php)
- Comments Template (comments.php)
- Footer Template (footer.php)
- Header Template (header.php)
- Links (links.php)
- Main Template (index.php)
- Page Template (page.php)
- Popup Comments Template (comments-popup.php)
- Post Template (single.php)
- Search Form (searchform.php)
- Search Template (search.php)
- Sidebar Template (sidebar.php)
- User Defined Templates (templatename.php)
This template will be loaded if a Page Not Found (404) error occurs on your site. There is a default 404 template included in the WordPress default theme that will be used if your theme does not include one. This site uses the default WordPress 404 template.
A very simple example for a custom 404 page from the WordPress codex follows.
<?php get_header(); ?>
<div id="content" class="narrowcolumn">
<h2 class="center">Error 404 - Not Found</h2>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
See also: Creating an error 404 page at the WordPress Codex.
An archive template lists posts from the archive, which will be a filtered list of posts based on date criteria, such as all posts for a year or month. Usually in an archive template, excerpts of the posts are shown along with links to the full post.
An archive index template (archives.php) is typically used to provide a list of links to archive posts, organized by year, month, etc. It differs from archive.php which will lists archive posts based on filter criteria (such as all posts for a specific year or month).
You can use this template to customize the profile display for authors on your blog.
The comments template, comments.php is usually included on individual blog post pages (single.php), and is used to control the display and listing of comments on a post.
This file is included in your other templates and holds the markup that is common to the footer of all of your pages, typically this file closes your site’s <body> and <html> tags
This file is included in your other templates and holds the markup that is common to the top of all of your pages, such as DOCTYPE declaration, <head> tags, scripts, stylesheets, etc. Usually the opening <body> tag is included here as well.
The links page template is used to display a standalone page that lists all of your WordPress links.
This is the main page of your theme, where blog posts are listed. Additionally, the way that the WordPress template hierarchy works, many of the other template files are optional, and if they aren’t present, WordPress will default to using this template.
The page template is loaded for static content pages as opposed to blog listings or posts.
This template moves the commenting ability of your theme out of the main post page and into a popup window. This was a common feature of some early blog platforms, but is rarely used now.
The single post template, single.php holds the code for showing one blog post (as opposed to static pages) and usually would be where commenting would take place on your site.
Many themes include a search form, that is usually included in the sidebar or footer area of the site. You can actually get the same functionality by using the search widget, which is an excellent and easy option if you don’t need to customize the form itself.
The search template loops over the results of a search (from searchform.php) in much the same way as posts are looped over in your main index template.
This template holds the code for your site’s sidebar content area(s). This is also one of the files where WordPress widget support is generally enabled (you will also need to add code to functions.php).
In addition to the standard templates, you can create your own when building a theme, but instead of using a WordPress Template Tag to include the file, you can use the PHP include() function with the TEMPLATEPATH variable to do so
<?php include (TEMPLATEPATH . '/templatename.php'); ?>