Friday, June 8, 2018

How to create a custom template file in WP

Step 1

Copy the page.php

Step 2 Create a new folder inside the theme folder named "page-templates"

Step 3 Paste the copy of page.php and rename it Some developers will group their templates with a filename prefix, such as page_two-columns.php *Alert: Important! Do not use page- as a prefix, as WordPress will interpret the file as a specialized template, meant to apply to only one page on your site.*

Step 4

Your template must begin with the following
/* Template Name: Example Template */
You can add any name u want

Step 5

Once you upload the file to your theme’s folder (e.g., page-templates), go to the Page > Edit screen in your admin dashboard. On the right hand side under attributes you’ll see template. This is where users are able to access your global page templates.

No comments:

Post a Comment