How to create Page template in worpress. - WPTRINITY

How to create Page template in worpress.

Page templates are a specific type of template file that can be applied to a specific page or groups of pages

Page templates are used to change the look and feel of a page.

There are two ways to apply template changes to the page.

First with WordPress page Hierarchy Structure


Steps ;
1. Create a page from wordpress backend and copy page slug.

2. Now Create a file with name like :
page-privacy-page.php inside your active theme directory (wp-content/themes/your-theme-name) and after this when you open the privacy page page show with that(page-privacy-page.php) page which you created not from the page.php

Second to create a saprate template and assign to the page.

In this way we create a saprate Php file with particular template name inside it and assign this template to the page from wordpress backend.
For php file work as template we need to add some commented code inside the template file.

<?php

/* Template Name:  Inner Page template



 */

get_header();
?>
  1. first create a php file inside your theme directory path (wp-content/themes/yourtheme) like:
    Inner-page-template.php
  2. Second open that file Inner-page-template.php add below code in file.

Steps ;

<?php

/* Template Name: Inner Page template



*/

get_header();
?>

Now after adding the code template is ready to assign any page From the wordpress backend.
Place image where you can assign the template to the page.

After assign the page to template page content come from that template.

you can customise and add code in template according to your need.

Leave a Comment

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