Creating a WordPress custom theme to maintain your website design becomes so much easier when you know about things like WordPress Custom Page Templates. In WordPress pages are very similar to Posts in that they both have Titles and Content and can use your WordPress Theme templates files to maintain a consistent look throughout your site. Pages, though, have several key distinctions that make them quite different from Posts.
What is a custom page template?
A custom page template is a file which located in your theme directory. By creating a custom page template, you can change the layout of a page or show different content to the standard page template. Actually it provides an alternative to the default page.php file. You can create an unlimited amount of page templates, and choosing the template you’d like to use for a particular page is as easy as selecting an existing template from a drop-down in the WordPress page editor.
The common uses for custom page templates are to create unique page layouts for about pages, contact pages, advertise page, testimonials or services page etc. You can embed your desired html content, media, image or functions in your custom pages. So if you need a page layout different with available default page.php file, a custom page template is what you need.
How to create a custom page template
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 */ ?>
Configure the template name to something meaningful, this is what will appear in a drop down menu within the WordPress admin screen. Saving the file with a name corresponding to your chosen template name makes sense, for example here we will create a custom page template for displaying post archives. For this we create a archive.php in “\wp-content\themes\webrevisions” with following PHP code..
Now you can work on your templates design and functionality. you can utilize header, footer and sidebar from existing theme or can build something completely unique using your custom design and functions. You can easily hard your required features and HTML content, image, videos or Google Maps iFrame etc.
When you’ve created your custom page template and uploaded it to your theme directory, create your page using the WordPress editor. Any content you add using the WYSIWYG will appear wherever the <?php the_content(); ?> tag was placed within the template. This page will use the default archives.php template unless your change the Template option under Attributes.
One you’ve finished your custom page editing. Go to the “Page Attributes” panel at right side of same edit page, select the Template menu and choose the template file with the name you supplied. Press the publish button and see your WordPress content dynamically generated using the design of your custom page template.