WordPress Custom Page Templates

Keith Curreri - Blog Headshot

By Keith Curreri on February 15, 2011

Sometimes you may want to create a page on your WordPress website that looks and acts different than the default page that comes with your theme. For example, your default page may have a sidebar, but you need to add a page that does not have a sidebar. This can be done by creating a custom page template in WordPress.

What are page templates?

Page templates are just like any other template in your WordPress theme – they display your content. You can customize the style/layout any way that you would like and you only use them when you specifically choose to use them.

When you create a new page in the WordPress editor they are created using a page.php file. The page.php file is called the Default Page Template. It usually just loads your content and displays it like a single post.

If you are familiar with the Twenty Ten default WordPress theme, you can see that there is already a page template called: “One column, no sidebar”.

How to create a custom page template

Let’s say, for example, that you have a sidebar on all of your pages in your website, but you want to have a page that doesn’t have a sidebar. Here is how you make a custom page template without a sidebar:

1)   Create a new file in your theme folder and name it noSidebar.php.

2)   Open page.php and copy all of the code and paste it into the newly created noSidebar.php.

3)   Make any changes that you would like to noSidebar.php. In this example we are going to remove the sidebar, so find the code that calls the sidebar (<?php include(‘sidebar.php’); ?>) and remove it.

4)   You may also want to find the div that contains the main container and add a width style to make it cover the whole page.

5)   Finally, and most importantly, add the following line of code to the top of the page. This code is used to tell WordPress that this is a custom template. Without this code, WordPress would not be able to find the template:

Template Name: Your Page Name

6)     Save this file and upload it to your server.


How to select a page template

Once you make the custom page template, you need to select the page that you want to use it on in the WordPress editor. To do this, create a new page (or open an existing one). On the right side of the screen you should see a “Page Attributes” box. In this box find the “Template” dropdown and select the name of the template that corresponds to the template name that you just created.

Did you like this post? Want to get more like it?

Website Redesign Course
Notify of
Inline Feedbacks
View all comments
Tara @ The Butter Dish
12 years ago

I’m new to WP and working in the Thesis theme and this is the first page I’ve found that actually explains exactly WHAT a custom page is in terms a newbie and not overly techy person understands.

I don’t know HOW to build the pages I want as I would like to have my categories listed as a gallery on particular pages, but I understand this is something that a custom page might be able to do.

If you have any ideas I’m all ears.

Thanks for the visual and easy education!!


12 years ago

Hey Tara,

I bet that this is something that WordPress can do, but I’m not 100% sure what you are looking to do. Are you trying to display only one category on a WordPress page?


Would love your thoughts, please comment.x