in WordPress

Create Custom Page Templates in WordPress

What is a Custom Page in WordPress

By default WordPress allows you to create post and pages. Your WordPress theme controls the appearance of your pages by utilizing a template file called page.php

This template file affects all single pages that you create in WordPress. However, not all pages are the same. Little changes in their layout and appearance can make them unique and a lot more useful.

Creating a custom page template in WordPress requires a basic understanding of HTML, CSS and HTML.

Having said that, let’s jump into creating your first custom page in WordPress.

Creating a Custom Page in WordPress

First, you need to open a plain text editor like Notepad on your computer. In the blank file add this line of code at the top:

1<?php /* Template Name: CustomPageT1 */ ?>

This code simply tells WordPress that this is a template file and it should be recognized as CustomPageT1. You can name your template anything you want as long as it makes sense to you.

Selecting your custom page template

Now if you change template and visit this page, then you will get to see a blank page. That’s because your template is empty and does not tell WordPress what to display.

Don’t worry, we will show you how to easily edit your custom page template.

Editing Your Custom Page Template

Your custom page template is like any other theme file in WordPress. You can add any HTML, template tags, or PHP code in this file.

The easiest way to get started with your custom page is by copying the existing page template provided by your theme.

Open your FTP client and go to your theme folder. There you will find a file called page.php. You need to download this file to your computer.

Downloading page template file

Open the page.php file in a plain text editor like Notepad, and copy all its content except the header part.

Template header of a typical page.php file in a WordPress theme

 

Write a Comment

Comment