WordPress GuidePages → Custom Page

How to create a custom page template in WordPress (3 ways)

Woman gets online to manage her Windows hosting account

Need a landing page that doesn’t show the sidebar? Or a full-width layout for your portfolio? WordPress custom page templates give you the freedom to break away from your theme’s default design—without overhauling your entire site.

Whether you’re customizing directly in your theme, using the block editor, or working with a page builder, creating custom templates lets you control how individual pages look and function.

Here’s everything you need to know to do it right.

Get fast, reliable hosting for WordPress

Power your site with the industry’s fastest, most optimized WordPress hosting

What is a WordPress page template?

A page template is a file that controls the layout and design of a specific page in your WordPress theme. Templates determine how your header, content, sidebar, and footer are arranged—or whether they appear at all.

By default, most themes use a single page.php file to render all pages. But when you create a custom page template, WordPress lets you override that default on a per-page basis. This is perfect for:

You can assign a custom template to any page from the WordPress editor.

Why use a custom page template?

Custom page templates give you fine-grained control over your layout without touching the rest of your theme. Here’s why they matter:

They’re especially useful for marketers, developers, and site owners who want to optimize individual pages for conversions or engagement.

Creating a custom template using the block editor

If you’re using a block-based theme, you can create custom templates right inside the Site Editor.

Here’s how:

Once it’s saved, you can assign this template to any page by editing the page and selecting it under Page > Template in the sidebar.

This is the simplest method if your theme supports full site editing (FSE).

Creating custom page templates manually in theme files

If your theme isn’t block-based—or if you need deeper control—you can manually create a PHP file for your custom template.

Step 1: Create the template file

In your theme folder (or preferably a child theme), create a new file. Name it something like page-custom.php.

At the top, add a special comment so WordPress recognizes it as a template:

<?php
/*
Template Name: Custom Landing Page
*/

This template name will appear in the editor dropdown.

Step 2: Add your layout structure

You can start by copying your theme’s page.php or index.php file, then modify it. Or you can start fresh:

<?php
/* Template Name: Custom Landing Page */
get_header(); ?>

<div class=”custom-container”>
<main id=”main”>
    <?php
    while (have_posts()) : the_post();
      the_content();
    Endwhile;
    ?>
  </main>
</div>
<?php get_footer(); ?>

Customize this template however you want—remove sidebars, add custom sections, change HTML structure, or enqueue specific styles.

Step 3: Assign the template

In the WordPress dashboard:

That page will now use your custom layout.

Using a page builder plugin for templates

WordPress page builders like Elementor, Beaver Builder, and Divi let you create custom layouts without writing code.

Here’s how it works in Elementor, for example:

Elementor Pro also allows you to create reusable page templates and assign them based on conditions—like page type, user role, or URL.

Other page builders offer similar functionality, and most are compatible with custom templates if you prefer to mix code and visual editing.

Tips and best practices

Advanced options for developers

If you’re building more dynamic templates, you might want to:

Register templates programmatically using the theme_page_templates and add_filter() functions

Additional resources

How to build a WordPress site →

A complete beginner’s guide that covers 9 key steps to a successful launch

WordPress excerpt length: What it is, how to change it →

Discover how to adjust the excerpt length in WordPress to improve content previews.

How to use WordPress Gutenberg blocks →

A complete beginner’s guide to Gutenberg blocks