Many people want to add custom designs to their WordPress theme. But, It’s completed for a non-programmer person. That’s why In this article I will show you how to add a template in WordPress or theme.
What is Template in WordPress Theme
If you want to add a template in your theme, first of all, you have to know what is the template in theme. The template is the website looking layout in WordPress theme. Suppose, how you want to look at your blog page, the home page, category page, etc. Mainly template layout depends on the developer who has created the theme. The user just defines a default template on their website. They didn’t add any custom template as their choice. If you are a user, you will find a template option in your dashboard page right sidebar which is located in the “Page Attributes” section. You can see the page attributes option below.
Let’s create a new option here
In this section, you can change your website page layout by choosing your desired template. Sometimes, you maybe not liked the default templates. That’s why you have to create a custom template in your theme. So, you can set the desired design on the website. Let’s talk about how to add a custom template to your WordPress website.
Create a file for a template
First of all, log in to your hosting control panel. Because of that, you have to create a file into the hosting root folder. After login your Cpanel, go to the root folder. Normally, root folder name is public_html in many hosting.
Now go the theme folder which is activated in the WordPress admin panel. Otherwise, you can’t see any output in the front end. Example: public_html > wp-admin > themes > theme_folder.
At this time, you will see many theme files in the folder. Which is created by the theme developer. Don’t edit those files. If you edit any file, it may be corrupt your website. Just create a file with a PHP extension. You can use any name of the file.
Comment on the file.
Now open this file into the editor. Write the following codes into the file.
/* Template Name: Your Desired Name */
Now go to the WordPress dashboard and try to create a page. I hope you will be seen a new option in Page Attributes drop down. It will be named with which name you have provided in the hosting root folder when you created the file. Now If you chose this option and create a new page, you will see a blank page. Because of that, you just initialize the template. It’s not done.
At this time, go to the control panel root where you have created a new file. Now you can design a new or put your designed code into the file. After putting the design code into the file, reload your website new page link (which page you have created recently).
Now, You can customize your website. If have knowledge about WordPress theme files, you can set others option.
If you don’t know how to install WordPress, you can read How to install WordPress in your server. It can help you.