WordPress Custom Page Template – How to Create It

WordPress is a really important piece of software for me. Probably for every online business creator. One of the reasons why it’s so popular is the fact that the platform is extremely easy to use, even for a non-tech-savvy person.

Even though WordPress is great, some aspects of it can still be adjusted to give us the maximum of their potential. That’s the case with standard WordPress pages.

In case you’re not that familiar with WordPress; there are two main types of content you can create in WordPress: posts and pages.

Posts are the primary vehicles of blogging. Each entry is organized by date with the newest one at the top of the blog. Pages are more traditional elements. They are, well, pages. You can create them using the exact same interface but they have a different purpose.

While posts are the content of your blog, pages are the meta-content. You’re creating posts whenever you have something new to share with your audience… new advice, insights, articles, etc. On the other side there are pages. The most common pages in blogosphere are “about” and “contact” – it’s where you provide some additional data about your blog and online business.

There are gaps in pages’ armor

Pages have only one problem (unless you’re using a fancy theme) – they all look the same. So no matter what page you want to create it will look exactly the same as the previous one. For instance, I’m guessing that the only thing that separates your about page from your contact page is the content in the main area of the page. Apart from that, all the sidebars, headers, footers, styling and layout are exactly the same, right?

This isn’t necessarily bad. You want your site to be consistent. To be predictable, so the user is not confused when browsing it. However, at some times you want to be able to create a slightly different page, for a special purpose.

For example, there are 3 main kinds of pages on this blog:

These are all pages. I created them by going to the “Add New Page” section in my WordPress admin panel. What’s really different about them is that they all use a different page template.

When I’m creating a new page I can choose from a number of available custom page templates. There’s a dropdown list near the Publish button for that purpose (image below).

wordpress custom page templates

(Note. If you have no templates defined you won’t see that dropdown field, but we’ll take care of that in just a minute.)

Custom page templates give you many possibilities. You can create whatever layout you like within them. You can ditch the sidebars, change the footers, whatever you want. Just one catch here: you must have some knowledge about HTML, CSS, and PHP, or be able to follow some instructions. Those new templates won’t create themselves…

What’s the value in custom page templates?

You see, standard pages are not perfect for every imaginable application. Sometimes you just have to use a slightly altered design to see your desired effects happening.

If you’re creating a landing page, for example, and you want to convince people to subscribe to your email newsletter, you should remove all distracting elements from such a page.

Landing pages are a specific kind of pages. They usually have just one goal: to convince the visor to do a specific action (like: clicking a link, or buying your product). The more distractions there are on the page the less possibility someone will actually do the action. And the biggest distraction of them all is the sidebar. Therefore, removing the sidebar altogether or transforming it into something that improves the experience even further is one of the first things you should do.

This can’t be done with a standard page. That’s where custom page templates come into play. They allow all this to happen.

How to create a custom page template

The easiest way of doing this is to take your standard page.php file and start modifying it.

So you just start by making a copy of it, giving it a new name (saving it as a .php file) and opening it in a text editor (Notepad++, for example).

One more thing. Basically, you can name your new file whatever you want, except for a small set of restricted names. Those are: index.php, comments.php, front-page.php, home.php, single.php, page.php, category.php, tag.php, taxonomy.php, author.php, date.php, archive.php, search.php, attachment.php, image.php, 404.php.

Now it’s up to you to do the editing of the file. Make modifications to the HTML and CSS structure. You either have to know the structure of your current theme to do this, or find someone to do the job for you. It’s an easy task for someone who knows WordPress, so it might be easier and faster to actually hire someone and just tell them what effect you’re looking for.

After you’re done with your new page the only thing you have left to do is input this piece of code at the beginning of the file:

<?php /* Template Name: UNIQUE_NAME */ ?>

Replace UNIQUE_NAME with whatever you want. It’s a good idea to make it descriptive. If for example, you’ve just created a custom template of a landing page with an opt-in form for an email newsletter, calling it “email opt-in landing page” might be a good idea.

Next step: upload the file to the server into your theme’s main directory.

From now on your new template is available in your WordPress admin panel whenever you’re creating a new page. Just select it from the dropdown list just below the “Publish” button.

Here’re some templates of mine just to give you an example what does this dropdown look like:

my templates

I encourage you to get familiar with custom page templates, learn how to create and use them effectively. They are a really powerful thing once you get to know them. My custom pages are ones with the highest rankings on Google from the entire blog. They can really do a lot for you and your online business or blog.

What’s your experience with custom page templates? What custom pages are you using on your blog?