I consider page templates to be one of the best features ever added to WordPress. It’s a feature that allows you to transform any regular ol’ page into a masterpiece. You can completely change how a page looks and functions with this feature. In fact, my love affair with page templates goes back quite some time. See this old blog post I wrote if you want to read more: Page templates: The untapped potential of WordPress.
Page templates are a WordPress feature that allows you to select an alternative template for individual pages on your site from the edit page screen in the WordPress admin.
What are page templates?
Page templates are a special type of template that you can select for any page (the “page” post type) on your site. Some page templates simply change the look of that page slightly (e.g., removes widgets). Other templates might change the functionality entirely (e.g., news theme front page). While other templates might just offer some additional functionality (e.g., post archives).
What these templates do can vary wildly and from theme to theme. Most themes here at Theme Hybrid will have at least a basic custom page template or two.
Can other post types have “page” templates?
WordPress does not allow this feature by default for other post types. However, the Hybrid Core framework (all themes here are built off this) has a built-in option for allowing theme developers to create custom templates for other post types.
If you’re interested in this feature, read the post templates tutorial.
Creating custom page templates
If you want to build some custom templates for your site or a theme you’re releasing, it is pretty easy to create a new template. Of course, what the template does is entirely up to you. It is a custom template, so I can’t tell you how to create something that’s custom.
Suppose you were building the ThemeHybrid.com site and wanting to create a custom template for the club page (this site use several custom templates and one of them is for this page). What you’d do is create a new file in your theme folder and name it
page-template-club.php. At the very top of the new file you’ve created, you’d add the following code block.
<?php /** * Template Name: Club */ ?>
Now, you’ve created a completely custom page template. The resst of the club page template used on this site is a bunch of custom PHP and HTML code. Your template would also be filled with custom code. It’s entirely up to you.
Selecting a page template
If you’ve built a custom page template or your theme comes packaged with page templates, you’ll be able to select a template on the edit page screen in the WordPress admin.
On the edit page screen, there’s a meta box labeled “Attributes” for pages. Within this box, you should see a drop-down select option labeled “Template.” From that box, you can choose the template you’d like to use for the individual page.
The following screenshot is an example of what my template selection looks like on this site.