How to Build Your Own WordPress Template
Internet users are probably familiar with WordPress as a hosting site for blogs and an entryway into creating one's own website. The website features hundreds of specially designed themes from which users can select the perfect match for their needs. However, sometimes the basic page templates available in those themes are not exactly what website designers are looking for, in which case the true genius of WordPress shines through.
WordPress has become incredibly popular precisely because of the ease with which its templates can be changed. In this way, website builders can craft a page template specifically for their own sites, ensuring that the template in question is precisely the right design. So how does one go about doing that? Here is a handy guide.
Part One: The Blank Template
- Step One: Creating the File
Begin by copying this line of code into NotePad on your computer:
<?php /* Template Name: InsertPageNameHere */ ?>
When you input this code into WordPress later on, it will inform the website that your file is a page template with the name “InsertPageNameHere.” You can name the page anything by changing out that chunk of text in the code.
- Step Two: Saving the File
Save the NotePad file in the .php format. This is a very important step, so make sure you use .php.
- Step Three: Using a File Transfer Protocol Client
At this point, the process may start to seem overly complex. But it is much easier than it seems. Simply take a look at this list of popular File Transfer Protocol (FTP) Clients and download one. Many of them are free. Once you have done that, all you need to do is enter in the address of your WordPress website and hit the “Connect” button. Now you're connected!
To upload your .php file (the line of code you wrote in Step One and saved in Step Two), you will need to find your theme in the FTP Client. Go to the directory marked wp-content/themes. Once there, upload the file.
- Step Four: Creating the Page
Now that you have uploaded the file to your FTP Client, which is connected to your WordPress website, head over to your website and open up your admin section. Click on the link to create a new page and scroll down to the box labeled “Page Attributes.” There, you should see a menu called Template which can be dragged down. Doing so should reveal the file you just uploaded to the FTP Client in Step Three. It will have the name you gave the original file, “InsertPageNameHere” in our example case. However, creating a page with that template will result in a blank page. This will be rectified in Part Two below.
Part Two: Filling in the Template
- Step Five: Downloading the WordPress Page Template
To fully edit your new page and craft it in your own image, you are going to need to download WordPress' existing page template. This is very easy to do, provided you are using the FTP Client downloaded in Step Three. Simply open your FTP Client, go to your theme folder, and look for the file called page.php. Download this file.
- Step Six: Copying Everything Except the Header
The next step is to open your newly downloaded page.php file in NotePad. Copy everything except the file's header. The header should be the line of text marked by asterisks in the left-most column. If you are unsure of what to look for in a header, check out examples on the WordPress Codex. You do not need the header information.
- Step Seven: Pasting the New Information
In Steps One and Two, you created a new NotePad file that you later uploaded to the FTP Client. Open that file back up and paste this new code, which should be everything in that page.php file except the header information, to the end. Save the file with this newly added code and upload it to the folder in your FTP Client just as you did in Step Three.
- Step Eight: Editing the Page
When you return to your WordPress website after uploading this new file to your FTP client, you should be able to go to that custom “InsertPageNameHere” page and edit it like any other WordPress page.
You can add or remove code if you are familiar with php or HTML, you can remove whole sections of the page like the comment section or sidebar, and you can use the built-in WordPress page editor tool. Regardless of which direction you take, you have just created your very own, immensely flexible, custom WordPress template.