Creating WordPress custom page template is must if you want to start with wordpress theme development. Custom template is a gold mine when you start to implement a new theme from scratch because from here you start bulding your theme. WordPress is one of the most used platforms for different purposes. If we’ll count all the websites which are built using a CSM as backend, 60% of them are WordPress. Learning to modify a theme or building a theme from scratch it’s one of the best things you can do.
WordPress Custom Page Template
In order to create a new custom page template you have to open your favorite FTP client and create a new file.
- Open your ftp client
- Go to wp-content/themes/YourTheme folder
- Create a new folder named: templates
- Inside the templates folder create a new file MyTemplate.php
- Add the following comment to the top of the page
<?php /* * Template name: MyTemplate */ ?>
It’s just simple. The above comment will create a new template in wordpress backend.
We can assign this template to a page in admin.
- Go in admin
- Create a new page
- In the right side of the page search the templates dropdown and select your new created template and hit save button.