How to Add a Theme Template in WordPress

Rachel Jul 09, 2026

WordPress, the world's most popular content management system, offers a high degree of customization through its themes. But what if you want to add your own custom template to a theme? This guide will walk you through the process of creating and adding a new theme template in WordPress.

50+ FREE WordPress themes | WordPress theme for coaches & bloggers
50+ FREE WordPress themes | WordPress theme for coaches & bloggers

Before we dive in, ensure you have a basic understanding of PHP, HTML, and WordPress theme structure. Having a local development environment set up is also beneficial for testing your new template.

This wordpress theme can reduce your blog work
This wordpress theme can reduce your blog work

Creating a New Theme Template

To create a new theme template, you'll need to follow these steps:

WordPress Theme Tutorial On How To Choose A WordPress Theme For Your A New WordPress Blog
WordPress Theme Tutorial On How To Choose A WordPress Theme For Your A New WordPress Blog

1. Navigate to your WordPress installation's 'wp-content/themes' directory via FTP or your hosting control panel's file manager.

2. Locate the folder of the theme you want to add the template to. For this guide, let's use the Twenty Twenty-One theme.

How to Easily Create a Custom WordPress Theme (No Code)
How to Easily Create a Custom WordPress Theme (No Code)

Naming Your Template File

WordPress uses the file name to determine which template to use. The naming convention is 'template-*.php', where '*' is the name of your template. For example, if you want to create a template called 'my-template', you would name your file 'template-my-template.php'.

You can also create templates for specific post types or taxonomies by using the post type or taxonomy name instead of 'template'. For instance, 'archive-product.php' is used for WooCommerce product archives.

Tips for Finding the Best WordPress Themes
Tips for Finding the Best WordPress Themes

Creating the Template File

Create a new PHP file with the name you've chosen (e.g., 'template-my-template.php') in your theme's folder. Open this file in a text editor and add the following code:

```php

Welcome to My Template!

The Best Themes to Create a WordPress Website or Blog!
The Best Themes to Create a WordPress Website or Blog!

This is a custom template created for the Twenty Twenty-One theme.

Here's what's happening in this code:

WordPress Themes | Download Professional Design Templates
WordPress Themes | Download Professional Design Templates
Blog Design Inspiration: My New WordPress Theme
Blog Design Inspiration: My New WordPress Theme
Templates & Themes | 792K+ to Download
Templates & Themes | 792K+ to Download
How I Built My Own WordPress Site In 11 Steps
How I Built My Own WordPress Site In 11 Steps
Where To Find The Best Kadence Child Themes & Kadence Block Templates - DIY Dream Site
Where To Find The Best Kadence Child Themes & Kadence Block Templates - DIY Dream Site
70 Best Free WordPress Themes in 2025
70 Best Free WordPress Themes in 2025
How to Add Custom Navigation Menus in WordPress Themes
How to Add Custom Navigation Menus in WordPress Themes
The operation of Divi and Divi Builder in WordPress : explanations
The operation of Divi and Divi Builder in WordPress : explanations
Elegant Themes – WordPress Themes for the Non-Designer
Elegant Themes – WordPress Themes for the Non-Designer
10 Best WordPress Themes You Can Use to Build Your Website
10 Best WordPress Themes You Can Use to Build Your Website
Your One-Stop Shop to Creating the Website of Your Dreams
Your One-Stop Shop to Creating the Website of Your Dreams
How To Add A Pinterest Widget on Your WordPress blog - WPkind
How To Add A Pinterest Widget on Your WordPress blog - WPkind
How to Start a Website using WordPress
How to Start a Website using WordPress
Free WordPress Themes And Paid Options, how To choose
Free WordPress Themes And Paid Options, how To choose
How to Download this Free Premium WordPress Theme • Blog There
How to Download this Free Premium WordPress Theme • Blog There
Complete WordPress Website Tutorial Step By Step!
Complete WordPress Website Tutorial Step By Step!
The Ultimate Guide to Properly Change a WordPress Theme
The Ultimate Guide to Properly Change a WordPress Theme
20 Best WordPress Themes for Freelancers | BeginDot
20 Best WordPress Themes for Freelancers | BeginDot
a man is working on a laptop with the title how to add image credit in wordpress
a man is working on a laptop with the title how to add image credit in wordpress
How Do I Choose The Perfect WordPress Blog Theme?
How Do I Choose The Perfect WordPress Blog Theme?
  • get_header(); and get_footer(); include the theme's header and footer files.
  • The Template Name line is a special comment that tells WordPress the name of your template.

Adding the Template to WordPress

Now that you've created your template file, it's time to add it to WordPress so you can use it.

1. Log in to your WordPress dashboard.

2. Navigate to 'Pages' > 'Add New'.

3. In the 'Page Attributes' box on the right, you'll see a 'Template' dropdown. Your new template should be listed there. Select it.

Using the Template

Once you've selected your template, you can design your page as usual. When you're finished, publish your page, and you'll see your new template in action.

You can also use this template for other pages by following the same steps to create a new page and selecting your template.

Editing Your Template

To edit your template, simply go back to your theme's folder via FTP or your hosting control panel's file manager, open your template file, and make your changes. WordPress will automatically use the updated template the next time you view the page.

Congratulations! You've successfully created and added a new theme template in WordPress. This new template can now be used to create unique, custom pages that stand out from the rest of your site. Happy coding!