Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Create a Custom Page in WordPress

Last updated on by
BlueHost - Recommended WordPress Hosting
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.


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »

Comments

  1. Stuart Alsop says:

    Thank you sooooo much for this tutorial. solved a big headache for me! Keep up the good work!

  2. Darren says:

    This page is fantastic! Thank you! I was messing around a little (a lot) with plugins when I did a search, came across this page, and figured this is way better than the other methods I was looking at to do something.

    One thing is that in the article, it isn’t immediately obvious that the code should be put on the page before being uploaded. I mistook it as inputting the code on the ‘add a new page’ text box. Second time I tried it, I stuck the code in the text file (also, it isn’t obvious that they should choose all files, and change the text file extension to .php), and it worked like a charm. You can even add blog1 / blog2 / etc… to get multiple themes up there if you so need.

    Thank you!

  3. Tim Reeves says:

    THANK YOU SO MUCH!!!!!!!!!!!!!!!!!!!!!!!!!! I have been trying to figure this out for 3 months now, came across your tutorial up and running with my new page template in 5 minutes.. I completely
    understand some of the comments above, as when you are first starting out everything is so confusing. But when you get a grasp of things it is so easy. AGAIN YOU ARE A LIFE SAVER,SCHOLAR,AND A GENTLEMAN !!!! : )

  4. lucas says:

    This is suppose to be for beginners? I can’t even pass the first step “You can start out by calling WordPress header and footer”
    what does it mean? whoever wrote this article has forgotten that is writing for beginners who tend to be clueless.
    I tried to call header and footer but nobody answer, maybe i got the wrong number.
    A screen shot will be quite useful.

    • Editorial Staff says:

      I think you misunderstood the site. WPBeginner caters for beginners of all level. This article is in the Themes category, and this is for beginner theme designers. The article clearly says that you need to have HTML / CSS knowledge before you can do this.

      We do have a beginners guide category – http://www.wpbeginner.com/category/beginners-guide/

      Instead of being really sarcastic, sending 2 separate emails and leaving a comment, you should consider being more polite. We do not get paid to write these tutorials. It is a kind gesture for the community, and many folks have learned from our site. It would be one thing to be pissed off, if you paid for something, and you didn’t receive it. This site is entirely FREE. We try to help as many folks as we can without charging a dime.

      -Syed
      Founder of WPBeginner

  5. Markus Freeman says:

    I’ve tried this and it worked like a charm, but the there’s one problem. The Posts didnt show, only the sidebar. what could be the problem?

    Thanks,
    Markus

  6. Karla Porter Archer says:

    Thanks for this tutorial.

    I’m trying to do this in order to create the author page (http://www.wpbeginner.com/wp-tutorials/how-to-display-an-author-list-with-avatars-in-wordpress-contributors-page/).

    I’m using a child theme. Does this file get added to the main theme file directory or the child theme?

    • Karla Porter Archer says:

      I just tried it in the main theme and it finally showed. So I’m assuming the answer is ‘main theme’ and that I haven’t broken it :)

      • Editorial Staff says:

        No this file has to be added in the child theme directory. While it would work in the main genesis folder, it is best practice to never modify anything in the parent theme.

        • Karla Porter Archer says:

          ah – thanks — that was my original presumption, but it didn’t show the template as an option for the page, so I second-guessed myself. I obviously didn’t add it correctly then, so off to try again!

  7. Max Garcia Jr says:

    WITHLOVEASH31 posted a question on 10/24/2011. Could one of the Editor’s please respond. I’d really like to know. I could really use this feature. Thanks in advance!

    • Editorial Staff says:

      We didn’t reply because they also commented right after that they figured it out. You have to use FTP to login and upload a new theme file.

  8. LJSkool says:

    Completely newbie here. I was fine right up until you got to “begin creating a custom page by opening a blank file in your text editor”. Um, yeah…. Would that be the “editor” link under “Appearances” within my site? How do I “open” this? My purpose to have a page with all my blog posts on one page. My theme does not do this. Thanks!

    • Editorial Staff says:

      Hey Jackie,

      Yes this article does require prior HTML/CSS knowledge. Text Editor can be Notepad, Dreamweaver, Notepad++ etc.

  9. Ruth says:

    this is the first help page that’s helped me without creating another set of problems.
    It worked! I never built a php page before and I pasted everything in exactly
    Thank you!

  10. Taika says:

    “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

  11. withloveash31 says:

    Oh never mind. I figured it out :)

  12. withloveash31 says:

    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

  13. nola says:

    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!

  14. saro.verhees says:

    Really awesome, exactly what i was looking for. Thanks

  15. scarab says:

    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

  16. Nina says:

    Brilliant!

  17. Alex Batista says:

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

  18. Frank says:

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

  19. Marc Shaw says:

    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

  20. Missy says:

    Hi,

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

  21. MOMO says:

    Excellent tutorial. cheers guys.

    Momo

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.