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

How to Create a Custom Page in WordPress

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
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 experts 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 »


  1. Ronny says:

    Great work, guys. Thank you very much. But one question please… How do i make this custom template pull posts from one particular category or categories? I’ve been building websites with wordpress for a while now but, this one seems knotty to me. I know there’s a plugin that does this, but I’ll rather go with the custom template method. Thanks, again…

  2. Chadly says:

    hey guys, is their a plugin you recommend for WP that creates great looking pages like this:

    You know, the pages that have the arrows pointing to things and almost a hand drawn look about the page.

  3. irfan says:

    Sir my websites homepage is in the form of custom link in wordpress menu and is not present in all pages also.I am a totaly newbie in website development so kindly help to convet this custom link into a page.
    2:kindly also help to remove read more from posts.


  4. karlonc says:

    Does this tutorial still apply to the newest wordpress?
    Also will it keep any of the attributes of the theme you are using?

    • WPBeginner Support says:

      Yes, it applies on latest WordPress and will keep all attributes of the theme you are using.

  5. Musarrof says:

    Please give details more and write it easily with screenshot. new word-press user cant understand your reading tutorial.

    • WPBeginner Support says:

      Thanks for your feedback. Please let us know which part you did not understand and we will try to explain it.

      • Carol H. says:

        I didn’t understand this part…

        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.

        How does one upload to one’s theme directory? (I have a site; does this have anything to do with this?)

  6. vinay says:

    where do we find the pages that were created with the add-new page link in wordpress.could someone help me out to figure out the pages.Thanks in advance

  7. Joanna Gasdogas says:

    oops. please ignore previous note.

    Thank you for these instructions.

    I have followed all your instructions, I believe correctly. However when I go to my WP editor to add content to this new template, nothing shows up on the page. It remains as a completely blank page.

  8. Joanna Gasdogas says:

    Thank you for this. I followed all the instructions. I have a blank template now. But when I go to my wp editor to add content, the content doesn’t appear in the new page.

  9. Marow95 says:

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

  10. Kikky says:

    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

    • WPBeginner Support says:

      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 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.

  11. Pol Alvarez says:

    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!

    • WPBeginner Support says:

      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.

  12. Ansar says:

    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

  13. ReNet says:

    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.

    • WPBeginner Support says:

      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.

  14. Sean says:

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

  15. Troy says:

    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!

    • WPBeginner Support says:

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

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

        • WPBeginner Support says:

          No it will still have the similar effect.

        • Surya says:

          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.

  16. niharika says:

    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 on my localhost.

    • WPBeginner Support says:

      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.

  17. Andrea says:

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

  18. Stuart Alsop says:

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

  19. 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!

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

  21. 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 –

      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.

      Founder of WPBeginner

      • eduardo says:

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

  22. 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?


    • Editorial Staff says:

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

      • James says:

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

        • Joe says:

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

  23. Karla Porter Archer says:

    Thanks for this tutorial.

    I’m trying to do this in order to create the author 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!

  24. 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.

  25. 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.

  26. 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!

  27. 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,


  28. withloveash31 says:

    Oh never mind. I figured it out :)

  29. 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

  30. 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!

  31. saro.verhees says:

    Really awesome, exactly what i was looking for. Thanks

  32. 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.


  33. Nina says:


  34. Alex Batista says:

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

  35. Frank says:

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

  36. 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

  37. Missy says:


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

  38. MOMO says:

    Excellent tutorial. cheers guys.


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.