fbpx

How to Create a Custom Page Template in a WordPress Theme

Create a Custom Page Template in a WordPress Theme

A website’s design can take a lot of time. You could still need to spend a lot of time creating and editing your pages, even if you employ a robust WordPress theme or page builder. Furthermore, you may opt to develop a unique custom WordPress template rather than use a prefabricated and standard layout.

You can use a custom WordPress template on any of your website pages by designing them. Consequently, you may change your website’s overall style without manually updating every page.

Here, we will examine the benefits of creating page templates with WordPress. Furthermore, we will learn how to create a custom WordPress page template. Let’s dive in!

develop a unique custom WordPress template

Why Do You Need a Custom WordPress Editor Template?

You can use a custom WordPress editor template for various purposes. Some of the ideas regarding how to create a page template with WordPress include:

  • To show the latest images category-wise
  • To embed any script, including Google Maps,
  • Authors should be listed.
  • To upload recent images,
  • To design a custom portfolio page
  • To include a contact page 

How to Select a Page Template in WordPress

Head over to the wp-content > themes folder. Open your WordPress’s existing theme folder and then upload your PageWithoutSidebar.php file.

Select a Page Template in WordPress

Navigate to the Admin Panel->Pages-> and select “Add New”. Here you will see a new custom page template on the right-hand side.

Select Add New in Admin Panel

Make a new page and fix its template to PageWithoutSidebar. After completing this, publish it.

Why Do You Need a Custom WordPress Template Page?

You can use your creativity to improve the design of your page by creating a page template with WordPress. If you want specific pages to be slightly different from one another, you may also design a custom WordPress template.

For instance, you might want the pages in your photography portfolio to be wider than the rest. If you have a website where you blog, you might want to add a sidebar to your posts.

Using a custom WordPress template may save a lot of time. If you decide to modify your designs later, all you need to do is to update your template, and the modifications will take effect on every relevant page. Thanks to this configuration, you can avoid the headache of having to change each page.

Steps to Create a Custom WordPress Page Template

Choose the manual method if you already know how to build a custom WordPress theme. This approach allows a comfortable level of design freedom over any unique template. However, you will need some technical experience for manual creation.

1st Step: Make a Template File

Open a preferred text editor. Now, add the below-mentioned code to get started:

  1. <?php /* Template Name: PageWithoutSidebar */ ?>

Your template can have any name of your choice. However, giving a name that can be recognized is the best way to go.

For instance, you could use the word “Tutorials” to describe a page template for a particular form of a blog post, like how-to manuals. In the same way, you can call a template “PageWithoutSidebar” if it doesn’t have the sidebar your theme has.

After adding the code, save your template file as “customizedpage.php.” Your file’s name is up to you. However, it must have the ‘.PHP extension.’

2nd Step: Upload Your Website’s Template File

Now, you will have to upload the above file to your WordPress website. For this, you can use a File Transfer Protocol (FTP) client such as FileZilla.

You must input your website credentials, which include your username and server hostname if you are using FTP for the first time. This data is accessible through the dashboard of your WP hosting account.

After integrating ConnectZilla into your website, head over to the wp-content/themes/folder and open the child theme folder.

Upload Your Website's Template File

Now, the template file you just made should be uploaded to this location. You should now be able to access this template on your website.

For confirmation, head to your admin area and create a new page. Alternatively, you can open a current one. If you go to the Settings panel, you can find the Template section. Click on the section to see your available options: 

Select Template section

Your new template ought to appear in the list. You will, however, get a blank page if you select this as the template and select ‘Preview.’

This is because we haven’t yet updated the file. Up next is the demonstration of how to personalize it.

3.0 Step: Template File Customization

First, copy the page template you already have for your WordPress theme. To do this, connect your website via FTP and head over to the existing theme folder. Next, search for a file named page.php and open it in any text editor.

Furthermore, you will have to write the following coding lines under the page.php file:

Template File Customization

After completing the above, open the custom page template file and write this code below the following line:

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

Now, your custom template file should appear as follows:

Template File Customization Appear

Now you can edit your custom page template file. Moreover, you get the option to add specific PHP code for adjusting your template as per your needs. Save all your edits after you finish them. Now, you should see your completed changes if you go to the page or post where you added the template and click to preview them.

Building a Custom WordPress Template Page With Elementor 

Here, we will demonstrate how Elementor can be used as a WordPress editor template. Create a Custom WordPress Page Template through a page builder tool and apply it to a few targeted pages using the builder’s free edition.

First Step: Template Design

After putting Elementor on your WordPress site and turning it on, go to “Templates” and click “Add New”: 

Custom WordPress Template Page With Elementor

After that, Elementor will prompt you to choose the kind of a template you want to make and name it:

choose template type

For the free version, there is an option to choose between a section, page, or landing page. For WordPress custom templates regarding posts, you can upgrade to Elementor Pro.

When ready, select the “Create Template” option. Your Elementor editor will be launched.

Your Elementor editor

On the left side, you will see some objects that you may drag and drop onto your page. You might want to modify your template’s page layout before you begin.

In the lower-left corner, select the Settings icon.

select Settings icon

Then, select your preferred page layout from the selection list. For instance, if you choose Elementor Canvas, the website will be entirely blank: 

select preferred page layout

You can begin adding elements to your page after selecting your page layout. As an alternative, you might start with an existing template.

You only need to click on the folder icon to access these Elementor templates:

select folder icon

It is now easy for you to select a complete page: 

select a complete page

Now you can select any page element to configure your settings. When ready, click the drop-down button next to “Publish.” Select “Save as Template”:

Select Save as Template 

2nd Step: Application of Templates to the Pages

After making a custom WordPress editor template and saving it, it’s easy to use it on any page made with Elementor.

To begin, click Pages, then go to Add New, and then click the “Edit with Elementor” button: 

Application of Templates to the Pages

Now a new page will be opened:

Now a new page will be opened

Using this feature, you can create unique elements, such as headers, footers, and single post templates, and then set the circumstances under which they should be displayed. You can decide to apply a single post template you make with the Theme Builder to all of your posts.

How CloudPages Can Help You Upload SFTP Files  

CloudPages is a seamless, simple to use and powerful control panel for cloud servers. CloudPages not only helps you in creating a custom page template in a WordPress theme, it also aids you in uploading SFTP files.

You must be thinking how it is possible. It is possible. All you need is to implement a few steps mentioned here:

You can upload files to your website in CloudPages using SFTP. You only need to set a password for your user or add your public key.

Head on to your server dashboard and select List Website in the sidebar

cloudpages sftp file upoad

 Now, choose the website you need to access the File Manager.

Upload SFTP Files  

Choose “Settings” on the left menu.  

Upload SFTP Files  

After clicking on the “upload”, click the “Change Password” button   

Upload SFTP Files  

Type your password in the input box and click “Change Password” as mentioned below:

Upload SFTP Files  

  Using this password and username, you can access and upload SFTP files. 

Wrap Up

Learning how to create a custom WordPress page template can save a lot of time and effort. Additionally, with this method, you can quickly modify the layout of your website to better meet your objectives. There are numerous themes that you can create, including WordPress single-post templates.

Become CloudPages

Community Member to Get Latest Updates.

Pin It on Pinterest

Share This
Scroll to Top