How To Create a Custom Page Template in WordPress
There are many blog hosting platforms available to the normal internet user that is very user friendly. One of these is WordPress, learn how to make a custom page below.
WordPress is one of the most commonly used web hosting sites. This is probably because it offers platforms that are easy to understand and use. Using WordPress does not require a thorough knowledge regarding coding and web designing.
WordPress is used as a host for blogs and websites alike. The basic template offered includes a sidebar that shows the site’s archives and a title bar. These, despite being useful as a reference, tend to make a page more like a blog and not a website. WordPress’ Page Template can be used in order to make a theme look more like a website.
Here are the procedures in creating a custom page template for WordPress:
- Create a plain text file in Notepad or a similar program and enter the following code:
Template Name: Sample Page
Save it under any file name that will identify it as the new page template. For example, you can save it as “sample_page.php”. Remember that this file must be saved in the directory of your current theme. Here, “Template Name: Page” identifies that this will be a custom page template.
- Open the .php file in your current theme.
- Select all or use Ctrl+a to highlight the whole code then paste it to the text file you have just created.
- Save the file and upload it to the theme directory.
- Go to WordPress and login to edit your page. Do not modify anything else.
- On the right side of the page editor, click on “Page Attributes”. Select “Template” and then “Test,” under the same.
- Click on “Update” or “Publish” to save your work.
View your page and make sure that it should look the same as before. There should not be any changes. This is because it has not undergone further customization yet. If it has somehow changed or if you encounter some errors, check again to see if you have made any mistakes in the coding. An easy way to check if the creation of a new template is successful is to delete any part of the coding in the new template. After having done so, refresh the page and see if the deleted code is now missing. If it is no longer there, the new WordPress template is good to go.
The WordPress custom page template should now have been created. Other necessary changes or additions to the page can be added below the existing code. The codes that will be added to the template will control the pages that will be using the new template. The page can now be customized accordingly. The owner can add scripts or other designs as long as they are added below the five lines of code shown above. Pre-made scripts or add-ons are readily available on the Internet. A quick search can help a person find specific things that he might be looking for. These can be edited to the user’s desire and then added onto their website.