How to Create a Custom Page in WordPress

Posted on October 3rd, 2009 by in Themes | 19 Comments  
How to Create a Custom Page in WordPress

Have you wondered how some people have completely different looking pages on their WordPress site or blog. In this tutorial we will show you how you can create a custom page in WordPress using the custom page template snippet. A custom page is helpful if you want to have a page that looks completely different than rest of your blog but still runs on the WordPress CMS. You can also use it as a homepage or a landing page.

To customize the design and edit styling for the page, HTML and CSS knowledge would be helpful.

You will begin creating a custom page by opening a blank file in your text editor and paste the following code at the very top:

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

Once you have added the code, save the page as: blog[templatename].php so it will be blogwpbeginner.php for this example. You can name it any other structure you like as long as it is a php file.

The above code is simply giving your template a name that you will later see that WordPress recognize, so we are calling our template WPBeginnerT1 but you can call it whatever you like for example, archive, contact, landingpage etc.

This page can use all php markups as your other pages can. If you need help you can use our WordPress Theme Cheat Sheet for Beginners. You can start out by calling WordPress header and footer, or you can go completely solo by doing everything in HTML.

If you do not call header.php, then you must make sure to add all the header information such as style.css and others.

Once you have completed editing this file save it and upload it in your theme directory (/wp-content/themes/yourthemedirectory/) where files like single.php and index.php are located.

Next you will need to login to your WordPress admin panel and Add a New Page. Since you have already written down all the text and settings in the php file, simply name the page and leave the content area blank. Look on the right hand side, you will see a box called Attributes below the publish button. Choose the template using the drag down button.

Custom Page Template

Add the Meta Information such as Title, Description and such if you have the SEO Plugin and Publish the page. Now this page will be using the template you specified.

But if you left the option for the content to be dynamic, then you will need to add content via the admin panel.

This is a very helpful tutorial for designers specially when using WordPress as a CMS.

About

Editorial Staff at WPBeginner mainly Syed and David.

Post comment as twitter logo facebook logo
Sort: Newest | Oldest
Personal Items 5 pts

Neglecting the site for some time and running out of ambition to post new content, here is another more popular post from the past. Originally posted on July 9, 2007, this post is getting the most views on the site and should still be relevant today. Sorry but I will probably not answer your theme-specific questions so I suggest you read the comments section.

There may be times when you want to create a blog page or that looks different than a normal page. Or Perhaps you want to use WordPress to run your entire website but want the main page of your domain to look completely different than a typical blog. This is an easy way to customize WordPress that can be very easily accomplished by creating a custom WordPress page Template.

URL : http://www.addvalue.com.au

"Since you have already written down all the text and settings in the php file, simply name the page and leave the content area blank"

How to do that ? My WP does not allow me to leave the content blank, it requires to type something on title before it lets create/edit page name, then if I type something, name the page and remove the text leaving it blank and publish it publishes whatever I typed on title before I removed the text...any advice ? Thanks,

Taika

withloveash31 5 pts

Oh never mind. I figured it out :)

withloveash31 5 pts

I was following your guide and everything went well until this- "upload it in your theme directory (/wp-content/themes/yourthemedirectory/) where files like single.phpand index.php are located." This might stupid but how do i upload the file to my theme directory? I did find a page under the name "Editor" where single.php, index.php etc are located, i just don't know how to upload the file i created. Please help :S

nola 5 pts

Excellent! I thought this would be a hard process. You explained it simply. I still need to work out a few things with how my theme displays the custom template, but now I've learned something new. Thank you!

saro.verhees 5 pts

Really awesome, exactly what i was looking for. Thanks

great post. This information was just what I was looking for. It took me about 40 minutes but I built a 'squeeze' page just like I wanted.

I still need to do some of the header work but is minor in my opinion.

Thanks

How to create a custom page in WordPress and put it how default?

freakin phantastic blog! This may be the best project site on the web...

Hey, I read a lot of blogs on a daily basis and for the most part, people lack substance but, I just wanted to make a quick comment to say GREAT blog!.....I"ll be checking in on a regularly now....Keep up the good work! :)

- Marc Shaw

Hi,

I'm on here now trying to do this. Let me see if I can pull it off.

Excellent tutorial. cheers guys.

Momo

Tweets about us: