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

Do you want to create a custom page in WordPress? You might notice that many WordPress sites have different layouts for different pages. A custom page allows you to have different layout in appearance from regular pages in WordPress. In this article, we will show you how to create a custom page in WordPress.

Adding custom page template in WordPress

What is a Custom Page in WordPress

By default WordPress allows you to create posts and pages. Your WordPress theme controls the appearance of your pages by utilizing a template file called page.php.

This template file affects all single pages that you create in WordPress. However, not all pages are the same. Little changes in their layout and appearance can make them unique and a lot more useful.

Creating a custom page template in WordPress requires a basic understanding of HTML, CSS, and PHP.

Having said that, let’s jump into creating your first custom page in WordPress.

Creating a Custom Page in WordPress

First, you need to open a plain text editor like Notepad on your computer. In the blank file add this line of code at the top:

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

This code simply tells WordPress that this is a template file and it should be recognized as CustomPageT1. You can name your template anything you want as long as it makes sense to you.

Once you have added the code, save the file to your desktop as, custompaget1.php.

You can save the file with any name, just make sure that it ends with .php extension.

For this next step, you will need to connect to your website using an FTP client.

Once connected, go to your current theme or child theme folder. You will find it in /wp-content/themes/ directory. Next, upload your custom page template file to your theme.

Now you need to login to your WordPress admin area to create a new page or edit an existing one.

On the page editing screen, scroll down to ‘Page Attributes’ section, and you will find a template drop down menu. Clicking on it will allow you to select the template you just created.

Selecting your custom page template

Now if you change template and visit this page, then you will get to see a blank page. That’s because your template is empty and does not tell WordPress what to display.

Don’t worry, we will show you how to easily edit your custom page template.

Editing Your Custom Page Template

Your custom page template is like any other theme file in WordPress. You can add any HTML, template tags, or PHP code in this file.

The easiest way to get started with your custom page is by copying the existing page template provided by your theme.

Open your FTP client and go to your theme folder. There you will find a file called page.php. You need to download this file to your computer.

Downloading page template file

Open the page.php file in a plain text editor like Notepad, and copy all its content except the header part.

Template header of a typical page.php file in a WordPress theme

The header part is the commented out part at the top of the file. We are not copying it, because our custom page template already has one.

Now you need to open your custom page template file and paste it at the end.

Your custom page file would now look something like this:

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

<?php get_header(); ?>

<div id="primary" class="content-area">
	<main id="main" class="site-main" role="main">
		// Start the loop.
		while ( have_posts() ) : the_post();

			// Include the page content template.
			get_template_part( 'template-parts/content', 'page' );

			// If comments are open or we have at least one comment, load up the comment template.
			if ( comments_open() || get_comments_number() ) {

			// End of the loop.

	</main><!-- .site-main -->

	<?php get_sidebar( 'content-bottom' ); ?>

</div><!-- .content-area -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

Save your custom page template file and upload it back to your theme folder using FTP.

You can now visit the page you created using custom page template. It will now look exactly like your other pages in WordPress.

You can now continue editing your custom page template file. You can customize it in any way you want. For example, you can remove the sidebar, add custom PHP code, add any other HTML you want.

You can add the content by editing the page in WordPress page editor screen. You can also leave the content area in page editor completely empty, and add custom content directly in your page template.

We hope this article helped you add a custom page in WordPress. You may also want to see our list of the best drag and drop page builder plugins for WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

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. Girija Tandel says:

    Thank you so muc for this wonderfull tutorial.
    This helps me a lot.
    It works great.

  2. Harish S Reddy says:

    Thank You , it works Great !

  3. Charmy Dexter says:

    It was like I’m reading 123. I hope a page template of a theme could be used in another theme.

  4. Uchenna says:

    please can you help me out. I have two themes. one for my desktop view and the other for mobile. i used any mobile switcher to get the mobile view working. I designed a static page for desktop theme and this is where my problem begins because once i set from “reading” to use static front page for the desktop theme, the mobile theme homepage stops displaying posts. please is there a way i can get this working? this is the site am talking about thanks in advnce

  5. Matthew says:

    Way easier than I thought this would be. Thank you!

  6. Rahul Tiwari says:


    Its really helpful for me and very easy to understand.


  7. jass says:

    thank you very much.This article really helps :)

  8. Steven Denger says:

    For a “beginner” this was not helpful. You did not explain the steps more in detail, like “go to your current theme folder” – how do I do this? And your FTP instructions were way to vague. If I was able to understand your instructions I wouldn’t have needed this wp-beginner in the first place as it is explained for those that have mor tech experience.
    These tutorals were not at all helpful and are just targeted for the more tech viewers.

    • WPBeginner Support says:

      Hi Steven,

      We are sorry that you didn’t find this article helpful. We will try to explain in comments.

      To connect to your theme folder you will need an FTP client. These are special software which allow you to connect to your webserver and upload, delete, and manage your files directly.

      When you sign up with a WordPress hosting provider, they send you an email with your FTP login credentials. If you did not receive this email then please contact your hosting provider via chat or email and then will send them to you right away.

      However, if using FTP seems a bit too difficult, then you can also use File Manager. It is a web based application available under your web hosting account. Login to your web hosting account and look for File Manager.

      Let us know if you need more help :)

      We will try to improve and make our articles even more beginner friendly in the future.

  9. Niki says:

    Many thank you for simple and informative article helped me to start :)

  10. Chibuike Mba says:

    Thank you very much, this your article about custom page have really pointed me in the right direction for I needed to override theme page in my plugin for some custom post types.

    Thank you once again.

  11. Wayne from Keys English says:


    What can I do if I see the successful transfer of the custompageT1 to my FireFTP client, but when I go into WP admin – create a new page – scroll down to template, the custompageT1 is not in the drop down list to select?



  12. zamaan says:

    Excellent, very useful. Thank you.
    but u fogot to tell where i want to add my custom php code in the template file :(

  13. Jaczkowski says:

    I learnt something new. Thanks alot

  14. Janet Fuller says:

    This is really extra ordinary. Generally, I do add a page and then create that. But today, I have known something new.

  15. nevenx says:

    is it possible to integrate another script to wp (e.g. faucetbox script) on this way?

  16. San says:

    Great article. Helps to ease my confusion

  17. Tak says:

    thanks for the very concise tutorial with simple examples. it was super easy to follow!

  18. Radhakrishnan says:

    Dear sir,

    I did what you say. but in my page edit screetn there no template comming in attribute. what i can do sir?

  19. levan says:

    many thanks to you my dear its very helpful

  20. Gabriel says:

    This is a great tutorial. Very simple and easy to follow. Thank you!

  21. Waleed Barakat says:

    Thanks for the tutorial! actually i have a games WordPress template and every time i try to create a page treat it as a game and not show the page content as usual, but i think everything will be okay after reading and applying this tutorial on my website:

    Thanks again

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.