Easily create custom WordPress template files
WordPress is great! In my opinion it’s one of the best PHP frameworks available. Ok, maybe “PHP framework” is a bit far-fetched but since I’ve started using and developing on WordPress for my websites, I’m not developing around other open source CMS (Content Management System) or other blogging systems any more. I’m also not using my own CMS that I have developed – even though there is still a couple of websites floating around that uses that system.
I’m using WordPress most of the time for the websites and online systems that I create these days eg: social networks, blogs, micro blogs, CMS websites, e-commerce sites, etc. In simple non technical terms, the motto I’m using now when I start a new development project is “Find a way to do it with WordPress“.
This is the first blog post in a series but if you have any questions regarding WordPress, leave a comment below or contact me.
Custom WordPress template pages
Online you can find thousands of ready to use WordPress templates. Some of these are premium and you get a bunch of free ones available as well. When you start with WordPress, have a look at the free themes directory on the WordPress.org website. You can also view these themes directly from your WordPress dashboard by clicking on the menu “Themes” underneath the main menu “Appearance“. From that page you will be able to search for various themes by category and other search criteria.
Some of the premium and free themes allows for customization directly from your WordPress dashboard. Some times you will want to change the look and feel of your theme in a way that will not be possible from the dashboard such as creating your own customized home page or any other pages on your WordPress site.
If you have a couple of pages with content about your business services and you would like each page to have its own CTA (call to action), custom template pages will allow you to create them.
Create template pages
The easiest way to create a template page is by looking at your activated theme files and duplicating the “page.php” file in your theme folder or creating a new “.php” file and adding the code below at the top of the file.
Template Name: Your template page name
Change the text from the code “Your template page name” to the name you would like to call your template. Tip: use a descriptive name dedicated to the template you are creating because once you have a couple of templates on your theme, it can get a bit confusing if they are not named correctly.
On the new template file you have created, you can change the look and feel of that page, create your own “call to actions” with big buttons, etc. Have a look at the stylesheet of your theme (usually style.css) if you would like to add or change any of the styles associated with your theme.
Link the template file to a page
Once you have created your template file, create a new page on the “Pages” section of your dashboard and select the template name from the “Attributes” section on the right hand side. Save the page as a draft or publish it and preview/view your newly created custom WordPress template file.
If you are creating a template file to be used as the home screen of your WordPress site, after you have published your template, click on “Reading” underneath “Settings” on your dashboard and select your template name as the “Front Page” from the drop down menu. This will then tell your WordPress system to use your template file as the home page instead of the default home page template shipped with your theme.
Leave a comment below if you have any questions on creating your own WordPress template pages.