How to Create a Custom Page Template in WordPress

Asian man wearing long sleeving using laptop on desk with lamp shade in front

From landing pages to special promotions, there are lots of reasons why you might want to know how to create a custom page template in WordPress.

This post answers when to use custom templates and reviews three options for how to create a custom page template in WordPress.

Do I Need a Custom Page Template for My WordPress Website?

Before you learn how to create a custom page template, let’s review if you need one. Why do the work if you don’t have to, right?

The word template can have several meanings when it comes to building websites. In the WordPress universe, people often conflate templates and themes. Your theme is what controls the look and layout of your website. In addition to style settings, each theme includes standard page templates, such as a template for what an archive page should look like or how a standard post will display.

When we talk about creating a custom page template in WordPress, we’re referring to building another template that’s not a part of your existing theme. For example, an eCommerce site will have templates for a homepage, category pages, and product pages. But if you wanted a special promotion where people needed to sign up for your newsletter or get a special discount, you would need a page template for that landing page.

When to Use a Custom Page Template in WordPress

The obvious answer to the question of when to use a custom page template is whenever your existing page templates can’t accommodate your design or needs. But you also need to consider balancing the benefits with the effort.

Templates work best when you use them repeatedly. Back to our eCommerce example, it makes sense to build a template if the store frequently runs these promotions. The template will save time on future builds because people can update the content without modifying the layout. But if you only need something for one page or one-time use, you might be better off using custom code with your existing page template.

3 Options for Creating Custom Page Templates in WordPress

To create a custom page template in WordPress, you can use the block editor, use a page-building plugin, or do it manually. The first two options are considerably easier and more beginner friendly. Let’s see how each one works.

1. Creating a Custom Page Template in WordPress with the Block Editor

If you’re using a block-compatible theme, you’ll have access to the new full site editing features. This method is the fastest and easiest way to create a custom page template in WordPress.

  1. Log in to your WordPress admin.
  2. Go to “Pages” and click “Add New.”
  3. In the template section of the sidebar, click “New Link.”
WordPress page setting showing status and visibility, template page, permalink, featured image, and etc.

4. Give the template a name and click the “Create” button. This name is for internal use and won’t be displayed anywhere on your site.

WordPress create custom template prompt, showing name to input, cancel and create button

5. The site editor will load. Then you can start building your template with blocks and patterns.

WordPress page custom template showing patterns to use, color, dimension, padding, border and etc.

6. When you’re done, click “Publish.” You can now use the template to create pages.

If you’re new to using blocks for building pages, check out these resources for help:

2. Using a Plugin to Create Custom Page Templates

If you don’t have a block-enabled theme, you won’t be able to use the Site Editor. If you still want a drag-and-drop experience for building your page template, you’ll need to use a page-building plugin.

  • SeedProd. You can use this plugin to build pages for your entire site, but it is particularly useful for adding one-off landing pages when you’re already happy with your theme.
  • Elementor. This page-building plugin brings drag-and-drop visual editing to your entire site.
  • Divi. This is another popular tool for adding visual editing for your site.
  • BeaverBuilder. This plugin enables visual page and theme building.
  • Kadence WP. Using blocks and a vast library of templates to pick from, building pages with this tool is fast and easy.

Page-building plugins can negatively impact your site loading speed. They add a lot of code, unused CSS, and JavaScript to a page. If you’re concerned about high traffic and slow loading times, be sure to test out any page builder before launching the page.

3. Manually Creating a Custom Page Template in WordPress

Finally, if you don’t have a block-compatible theme and don’t want to use a page-building tool, you can manually code your own page templates.

Create a .php template file. When picking a file name, do not use page- as the prefix for the file. WordPress views page- as an instruction to only use the template for one specific page.

At the top of your file, you’ll need to state the templates name like this:

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

From there, you’ll create the template using HTML, template tags, and PHP code.

When you’re done, upload the file to your current theme’s directory using an FTP client or file manager.

To save time when creating a custom page template, WordPress recommends making a copy of your theme’s page.php file so you can start by modifying your existing template instead of coding everything from scratch.

Once you’ve added your file to your theme folder, it will be available as a choice when creating a new page.

Get a Free Staging Site to Test New Templates and Designs

When trying out new designs or building new page templates, it helps to have a way to test them without messing up your current site. At Pressable, we’ve got you covered.

All Pressable plans include a free staging site. You can create a copy of your live site and then use the staging site to try out new designs behind the scenes.

Pick a managed WordPress hosting plan today and start enjoying this and all the other perks of hosting with Pressable.

Nox Dineen-Porter

Nox possesses a unique blend of industry and academic expertise, seamlessly integrating her knowledge of communication, software development, and research. Her journey with WordPress began in 2003, first as an avid blogger and later as a skilled software developer. Her fascination with WordPress led her to join the Pressable support team, where she effectively combines her passion for technology with her love of problem-solving and her deep understanding of user behavior. As a PhD candidate, Nox is poised to make a significant impact on the field, bringing together her expertise in research, communications, and software development to provide context and clarity about health science and devices to the public. When she's not at her computer she enjoys hiking, running, yoga, and street photography.

Related blog articles