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
Follow WPBeginner on YouTube
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 »
  • Marow95

    How can I change the url ?
    I mean instead of “blog/?page_id=2″ , I want it to be “blog/about” .
    Thanks in advance :)

  • Kikky

    hallo, thanks for the post on creating a custom template, its helped greatly. But i have some issues i need answers to, this is my first time at wordpress and on the site i’m creating, i already have a custom template as the home page and then i have another page (with the theme’s initial homepage look, which is a custom page). the challenge i’m having now is : i want the custom template page i designed to load first but the theme’s custom page keeps coming up instead. i figured there’s some sort of conflict going on since they both have thesame url …so, preeeetyyy please, how do i get through this huge problem…thanks

    • http://www.wpbeginner.com/ WPBeginner Support

      Seems like you resolved your problem. In this case, you could have specifically told WordPress to use a template for a specific page. For example if you wanted to create a custom template for http://www.example.com/home-2 then you name your template file to be page-home-2.php. You can also use a page’s id in the template, like page-33.php will only work on page with 33 as the unique id.

  • Pol Alvarez

    Hi! I have always coded my webpages from scratch but now I need to add one to a wordpress website. I mean I have good html/css and this kind of stuff but little of wordpress.

    I have followed the instructions and succesfully uploaded the file. The problem is that it is not listed on the template dropdown. I am not sure whether this happens because the file I created is not valid or any other problem. My file is composed of your header

    and then following it a normal webpage (opening with etc…) without any styles now external files (just to check it out).

    What am I doing wrong? any help would be appreciated.

    Thanks you are my last resort!

    • http://www.wpbeginner.com/ WPBeginner Support

      Pol, we can provide you some tips to troubleshoot.

      Please study the file page.php in your theme’s directory. Your custom page template should follow the same structure as page.php except the header part where you need to insert your own template name so that it can distinguished.

      Make sure that you have uploaded your template to the right directory. It should be in /wp-content/themes/your-theme-name/ folder.

      Let us know if this helped.

  • Ansar

    I have a problem with this.when i add new page there is no option of template in page attributes. I’m using wordpress 3.8.1
    And also what is the name given to the page we are newly creating

  • ReNet

    This is Great! BUT HELP!
    I created a template that pulls in a form, I currently have it with a Captcha but want to remove the captcha and use WordPress’ password protect functionality for this page so I can speedup multiple form entries.

    The issue is that WordPress displays the template’s content before entering the password.

    Your help would be greatly appreciated.

    • http://www.wpbeginner.com/ WPBeginner Support

      ReNet, thats because the password protect functionality implements password on the contents of the post/page that is protected not on your template. So the form you want to hide should be executed inside the post. You can create a shortcode for that and add it to your post/page.

  • Sean

    Thanks for this – who knew it could be so simple!

  • Troy

    Ok so I think Im missing a step or two…
    1) I opened up a blank text document, copied this “1” into the first line of the notepad

    2) Saved it to my desktop and loaded it into the proper wp-admin//themes/mythemedirectory/

    3) Got it to show up on wordpress. Then I copied and pasted my html code for my splash page that I created in dreamweaver into the text(html) portion on wordpress.

    4) Saved it as a draft and when I previewed it I get a bunch of strange text.

    Can you explain to me what steps am I forgetting or missing. I think its something with the other php markups? or maybe where I post my html code. Im looking to have splash page without any menus or anything else besides my splash page coding. Any help or assistance would be greatly appreciated. The information you provided has gotten me farther then any of the other blogs Ive looked at so thank you very much!

    • http://www.wpbeginner.com/ WPBeginner Support

      It seems like you are trying to design a page in Dreamweaver and trying to import it in WordPress. This will not work. Because your page already has a structure and style defined by your WordPress theme.

      • Troy

        thanks for the reply. Can I just take the html body from dreamweaver and paste it into the theme?

        • http://www.wpbeginner.com/ WPBeginner Support

          No it will still have the similar effect.

        • Surya

          You can do that but try pasting the code in notepad first and then copying it again to WordPress. This usually eliminates some unwanted things like DOM.

  • niharika

    I have one question please……………. help me. I want to store marks of student in Mysql database and once user go to the result page he has to enter his roll no and class, then he see his result. I have done this project but I really don’t know how to go through it in wordpress i.e where to write html and php coding in wordpress.
    I am using WordPress.org on my localhost.

    • http://www.wpbeginner.com/ WPBeginner Support

      For that you will have to create your own custom solution using Custom Post Types, Custom Fields, and User Meta Data. If you look around you might find some WordPress plugin that already does all that.

  • Andrea

    Thanks for the post – this was exactly what I was looking for, and so helpful!

  • Stuart Alsop

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

  • Darren

    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!

  • Tim Reeves

    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 !!!! : )

  • lucas

    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.

    • http://www.wpbeginner.com Editorial Staff

      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

      • eduardo

        thaaaaannnksssssssss im a front end developer and i consider myself a wp beginner i found this article really helpful

  • Markus Freeman

    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

    • http://www.wpbeginner.com Editorial Staff

      That means that there is something wrong with the code in your template.

      • James

        I tried this too and like above only the sidebar shows. What could be wrong with the code in my template?

        • Joe

          Try copying the WordPress hook ( if statement) from the page.php file. Then paste it into the new file.

  • Karla Porter Archer

    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

      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 :)

      • http://www.wpbeginner.com Editorial Staff

        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

          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!

  • http://twitter.com/maxgarciajr Max Garcia Jr

    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!

    • http://www.wpbeginner.com Editorial Staff

      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.

  • LJSkool

    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!

    • http://www.wpbeginner.com Editorial Staff

      Hey Jackie,

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

  • Ruth

    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!

  • Taika

    “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

    Oh never mind. I figured it out :)

  • withloveash31

    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

    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

    Really awesome, exactly what i was looking for. Thanks

  • http://www.srinternetservices.com scarab

    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

  • Nina

    Brilliant!

  • Alex Batista

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

  • http://workingonit Frank

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

  • Marc Shaw

    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

  • http://www.ebookreaderguide.com Missy

    Hi,

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

  • http://www.boobacraft.com MOMO

    Excellent tutorial. cheers guys.

    Momo