A Quick and Easy Guide to Default WordPress Template Pages


A Quick and Easy Guide to Default WordPress Template PagesWordPress is set up to find and accept certain file names for certain pages. You might recognize page.php (for your standard page), single.php (for each post),  or archive.php (for your blog archives). But WordPress has some other built-in file names you can use for automatically setting templates that are a little less well known.

Common Templates

The most common template pages include:

page.php. All regular pages come from this template.

index.php. This page lists all of the blog posts.

single.php. Each individual post is shown using this template.

archive.php. Archives of your posts come from this page template.

category.php. Each Category of your posts comes from this page (unless you don’t have it, then they come from archives).

search.php. Anytime anyone searches, this template is what comes up.

404.php. Obviously the 404 error page for your site.

Customized Page Templates

page-{slug or id}.php. If you want to create a page template for a specific page, you can create a template using this layout. For example: page-contact.php or page-8.php. The downside of using this is if the slug changes or you want to use a page with a different ID, WordPress can’t connect it anymore.

category-{slug or id}.php. Just like the page customized template, this template deals with the list of posts that are in a certain category. This one’s a bit more useful, in my opinion, then the page one above.

single-{post-type}.php. Like the two above, this template is for single posts that have certain post types.

*Note: if you’re used to using sidebar-{template}.php, note that this is the old way of sidebar templates. Now sidebars are registered and called much like menus.

anyname.php. Alternatively, if you want a little more flexibility on your page templates, just name the file anything (not already used). Once you add the following coding to the top of the file, it will show up under all the pages in the Template dropdown area:

Template Name: AnyName

Unusual Templates

front-page.php. This template is for creating a separate front page, something to use other than just a regular page or a list of blog posts.

tag.php. A bit unusual, this template is for displaying all posts that have a certain tag.

author.php. Anytime you link to an author’s information.

date.php. A list of posts on a certain date.

image.php. If an image is clicked to go to the attachment page, this template show it.

Partial Templates

WordPress doesn’t get all of a page’s information from one page, but rather pulls from several files. Here’s a list of the partial templates you can edit.

header.php. The header for the entire site.

footer.php. The footer for the entire site

sidebar.php. The sidebar for the site.

comments.php. The comments template for the site.

searchform.php. This displays the search form.


The built-in WordPress templates is just one of the many ways WordPress makes it easy to connect your website together without extra work for you.