By Digital Hub on April 14th, 2019
WordPress is the best publishing platform. All the content in WordPress is written in the form of Posts or Pages. It’s easy and fun to create a new cms page in WordPress and on the same it gives us the ability to add a custom template file where static or dynamic content can be added by the powerful functions of the WordPress.
All the custom template files are placed inside the themes directory which is wp-content/themes/themename.
To create a custom template file, first of all, we need to create a new .php file inside the current themes directory. Create a file named mytemplate.php. Yes, we are free to use any name for our template file but for now, we will use my template as our template name. Also, WordPress has reserved some names for its personal usage, so make sure to not to conflict your name with any of these names. You can find the list of reserved theme names here
Copy this code in the new template
Now we need to add some identifiers in the file so that WordPress could identify this file as a template and add in the templates dropdown.
And that’s it. Our own template page is ready.
Go to Pages > Add New or choose any existing page.
At the right sidebar on the Edit Pages inside the section Page Attribute, there is a template dropdown. If everything happens fine than my template will be listed in this dropdown. Choose mytemplate as a template and save the page. Now check it on the frontend its blank. Why is it blank? Because it needs some WordPress functions to get the ability to show the content. The easiest and best way is to simply copy code from index.php or page.php or from any other default template file and modify it as per your requirements.
Reference link: http://codex.wordpress.org/Pages