How To Create Custom Page Template In #WordPress

preview_player
Показать описание
Do you want to create a New Page Template in #WordPress? You might notice that many #WordPress sites have different layouts for different pages. A New Page Template allows you to have a different layout in appearance from regular pages in WordPress. In this video, we will show you how to create a New Page Template 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:

/* Template Name: CustomPageT1 */

This PHP 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.

You can save the file with any name, just make sure that it ends with a .php extension.

For this next step, you will need to connect to your website using an FTP client.

Once connected, go to your current theme or child theme folder. You will find it in /wp-content/themes/ directory. Next, upload your custom page template file to your theme.

Now you need to login to your WordPress admin area to create a new page or edit an existing one.

On the page editing screen, scroll down to the ‘Page Attributes’ section, and you will find a template drop-down menu. Clicking on it will allow you to select the template you just created.

Now if you change the 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.

🙋‍♂️ Have a question? Leave a comment below and I’ll do my best to respond.

Рекомендации по теме