How to create a custom page template in WordPress

First you need to connect your website through FTP client and browser the theme directory
“/wp-content/themes/your-theme”

The Best way to create template you can use any existing page template (e.g. page.php) from your theme instead of create from scratch. Custom Page Template allow you to different the page appearance from regular pages.

1. Copy the page.php (or any existing template) and rename it with the template name you are going to create, like template-home.php for home page template.

2. Open the file and add below code at the top of your template
<?php /* Template Name: Home Page Template */ ?>

3. Upload the file to your theme directory.

Select the page template for page you want to use

Edit/Add Page and select the Page template you created in Page Attributes section under Template Also check in the screenshot as well.

After select the template save/publish the page.

Leave a Reply

Your email address will not be published. Required fields are marked *