All custom page templates must start with the following code. It tells WordPress that the file is a custom page template, and sets the name of the template.
<?php /* Template name: My Custom Page Template */ ?>
Note: you can change Template name as per your requirement. just put the name which you want at the front of the “Template name:”
File Creating
- In your code editor, create a new file in the theme directory. Call it ‘my_custom_page.php’.
- In the first line of the file, insert the following code:
<?php /* Template name: My First Test Page */ ?>
- Open the existing page.php file.
- Select all of the code and copy it and paste the copied code under the code you just inserted.
- Save the file and login into your site wordpress admin
- Edit the page you would like to use to this new page template
- Under ‘Page Attributes’ (usually found on the right-hand side of the editor), select ‘My First Test Page’ from the ‘Template’ drop-down and update/publish your page.