How to Create a Custom WordPress Page Template

wordpress photo

Most of the WordPress themes have some built-in page templates, but you can give a unique look by using a WordPress custom template. You can design your WordPress pages in different ways. For example, if you have sound knowledge of PHP, you can code PHP templates. Else you can use plug-ins to create the page in WordPress.

What is a Page Template?

WordPress pages and posts are available in the themes directory and you can find a file named “page.php” in your C-panel directory or file manager. Now, either you can use the same design for your whole website and use the same page layouts for your different pages, or you can create a WordPress custom page template. Creating a custom page in WordPress is not a difficult job. By following some basic steps, create your WordPress page template.

Wordpress page

How would you create a child theme in WordPress?

Before you create a customized page template for your website, you need to know about your page attributes, template hierarchy, and the type of templates that you are using for your site. You can easily locate the template that you are using in your admin dashboard. Here are the steps you may follow:

  1. Login to your admin dashboard of WordPress.
  2. Click on the pages.
  3. Hover over your pages and select the “Quick Edit” option of a page.
  4. Now, you can click on the Template option, and you will find the theme templates over there.

Now, you need to design a WordPress custom template, which is completely different from your theme or built-in templates. You can enable the full-width option of your theme template, but you will not find comment templates and custom post types pages in your theme. Even, few WordPress themes do not allow you to add a second sidebar in your pages.

You can use your WordPress custom templates along with the built-in theme page templates. But, before you make any changes in your WordPress theme, you need to use a child theme. WordPress child theme is a sub-theme, where all your changes will be saved. If anything goes wrong while you create and apply your custom WordPress page template, your parent theme would not get affected.  

How to Create a WordPress Page Template?

  1. Go to your cPanel.
  2. Click on the File Manager.
  3. Click on the public_html, go to WP-content and click on the Themes folder.
  4. Now, you can access your themes folders, and you can add a new folder here.
  5. Give a proper name to your folder; and use hyphens instead of space.
  6. Now, you need to create another folder inside your existing folder, and you should name it “style.css”.
  7. Now edit this file by right-clicking on it and paste your PHP source code for creating custom page templates here.
cPanel WordPress

The easiest way to change the template in WordPress is to use some page-specific tags. For example, you can find some conditional tags in your pages that are already in use, and you can change such tags to redirect your users or customers to a specific page. You can use such tags in the page ids, title or URL.  You can mention home, category, single post, and 404 tags in your respective default page templates.

But, if you want to customize your WordPress page template, you need to follow the below-mentioned steps:

·       Choose a custom page template: In your WordPress dashboard, you can check the page attributes and you will find a custom page tab.

·       Here, you can find your page templates, and you may choose the one that you need to use for the respective page.

You can also avail such options on all your pages. You just need to hover over your pages and choose the “Quick Edit” option, and you will find such templates to choose from. It is better to copy the template that you are using and modify the same as per your wish. You can upload your modified version by changing its name as well. For example, if you are using a Child Theme like Twenty Twelve then you can use the following template for your standard page:

Source: https://www.smashingmagazine.com/2015/06/wordpress-custom-page-templates/

Make sure, you upload your WordPress custom template in the sub-folder as stated above. You need to add a folder in the WP-content and create a subfolder as “style.css”. You need to upload your custom WordPress page template in this folder only. Once you upload your templates, you can refresh your WP dashboard and you will find your custom templates at the “Quick Edit” option of your pages. Just choose your custom page and activate the same.

Create WordPress custom template through Plug-in

If you do not know about coding and PHP, then you can use a plug-in called WP Page Templates for creating a custom page. With this plug-in, you can add the left and right sidebar, and you can also use such sidebars at the above or below section of your content. You can also change your widgets through this plug-in. But, using PHP code can give you complete freedom to customize your WordPress pages, which you cannot achieve through a Plug-in. So, create your custom WP pages, and make your WordPress site more attractive.

Leave a Reply

Your email address will not be published. Required fields are marked *