SlideShare a Scribd company logo
How to Create Custom Page
Template in WordPress
By Makitweb
In WordPress, you can easily customize the page by editing the page.php file of
the active theme. But the change will affect on all pages where no need of
customization.
You can avoid this by creating the custom page template.
Using this you can design different-different layout for the pages and add extra
content to it without affecting regular pages on the site.
Contents -
1. Create Template file
2. Apply Template
3. Conclusion
1. Create Template file
● Navigate to your active theme directory e.g. – twentyseventeen.
â—Ź Here, create a new directory page-template to store template files.
How to create Custom Page Template in WordPress
â—Ź Open contactpage.php.
â—Ź Create a new contactpage.php file inside page-template/ directory. You can
rename the page to something meaningful name if you want.
Add code
To tell the WordPress that this file is a template file by adding the following code
at the top and save it. Now the following template name visible on the
WordPress Dashboard page template section.
<?php
/* Template Name: Contact page Template */
Add some more code and create a contact form.
<?php
/* Template Name: Contact page Template */
get_header(); ?>
<style>
input[type=text], textarea {
width: 100%; padding: 12px; border: 1px solid #ccc;
margin-top: 6px; margin-bottom: 16px; resize: vertical;
}
input[type=submit] {
background-color: #007eff; color: white;
padding: 12px 20px; border: none; border-radius: 4px; cursor: pointer;
}
.container {
border-radius: 5px; background-color: #f2f2f2; padding: 20px;
}
</style>
FULL CODE -
<div class="wrap">
<h3>Contact Us</h3>
<div class="container">
<form action="">
<label for="fname">First Name</label>
<input type="text" id="fname" name="firstname" placeholder="Your name..">
<label for="lname">Last Name</label>
<input type="text" id="lname" name="lastname" placeholder="Your last name..">
<label for="subject">Subject</label>
<textarea id="subject" name="subject" placeholder="Write something.." style="height:200px"></textarea>
<input type="submit" value="Submit">
</form>
</div>
</div><!-- wrap →
<?php
get_footer();
2. Apply Template
â—Ź Login to Admin Dashboard and navigate to Pages->Add new or Edit an
existing page.
â—Ź Template list display in Page Attributes section.
â—Ź Select Contact page Template option from the dropdown.
How to create Custom Page Template in WordPress
â—Ź Save and View the page.
3. Conclusion
It is better to use custom templates if you only want to customize specific
pages. You can create separate page-template for multiple pages.
Share
For More WordPress related tutorial
as well as other programming tutorials visit :
Makitweb.com

More Related Content

What's hot (20)

PPT
Css Founder.com | Cssfounder Org
Css Founder
 
PPTX
HTML 5 Web Design
Usman Shakir
 
PDF
html
cloverbadger34
 
PPTX
Html & CSS
JainilSampat
 
DOC
Printable version (must have Word)
butest
 
ODP
The (X)HTML Document
LearningNerd
 
PPT
Css Basics
ehorner
 
PPT
Ddpz2613 topic6 frame
Mohamad Sahiedan
 
PDF
Designing and Developing Windowed Interfaces for Web Apps
Steve Smith
 
PPTX
Css intro
Andz Bass
 
PPTX
How to use the new meeting report
eastfreolacrosse
 
PPTX
Introducing the style tag 2830
mdjstudios
 
PDF
Iwt assignment 1
SANTOSH RATH
 
PPTX
Web development Training in Ambala ! Batra Computer Centre
jatin batra
 
PPTX
Very basic intro to HTML
kmcintyre3
 
PPTX
Welcome to css!
sidneyodingo
 
PDF
Style Your Site Part 2
Ben MacNeill
 
PDF
MODXpo 2013 - Fail compilation
Sterc Internet & Marketing
 
PPTX
Web development using HTML and CSS
SiddhantSingh980217
 
Css Founder.com | Cssfounder Org
Css Founder
 
HTML 5 Web Design
Usman Shakir
 
Html & CSS
JainilSampat
 
Printable version (must have Word)
butest
 
The (X)HTML Document
LearningNerd
 
Css Basics
ehorner
 
Ddpz2613 topic6 frame
Mohamad Sahiedan
 
Designing and Developing Windowed Interfaces for Web Apps
Steve Smith
 
Css intro
Andz Bass
 
How to use the new meeting report
eastfreolacrosse
 
Introducing the style tag 2830
mdjstudios
 
Iwt assignment 1
SANTOSH RATH
 
Web development Training in Ambala ! Batra Computer Centre
jatin batra
 
Very basic intro to HTML
kmcintyre3
 
Welcome to css!
sidneyodingo
 
Style Your Site Part 2
Ben MacNeill
 
MODXpo 2013 - Fail compilation
Sterc Internet & Marketing
 
Web development using HTML and CSS
SiddhantSingh980217
 

Similar to How to create Custom Page Template in WordPress (20)

PPTX
Wordpress workflow for an agency world
Chris Lowe
 
PPT
WordPress Theme Design - Rich Media Institute Workshop
Brendan Sera-Shriar
 
PDF
Newbies guide to customizing word press themes 25
New Tricks
 
PPTX
Most widely used WordPress tips and tricks of 2016
Reegan
 
PDF
WordPress Sunshine Coast Customizer
Cameron Jones
 
PPTX
Writing your own WordPress themes and plugins
Stephanie Wells
 
PPTX
Build a WordPress theme from HTML5 template @ Telerik
Mario Peshev
 
PPT
WordPress 2.5 Overview - Rich Media Institute
Brendan Sera-Shriar
 
PPT
Easy Guide to WordPress Theme Integration
Sankhala Info Solutions
 
KEY
WordPress Developers Israel Meetup #1
Yoav Farhi
 
PPTX
Overview on WordPress theme file structure and working functionality
Rakesh Kushwaha
 
PDF
Optimizing The WordPress Admin For Users
👩🏻‍💻 Cristina Robinson (She/Her)
 
PDF
A2WPress Appointway Theme Documentation
A2WPress
 
PPTX
Editing Wordpress in Dreamweaver
Garin Kilpatrick
 
PDF
Make WordPress Themes
Alison Foxall
 
PDF
Managing WordPress Websites - Training Course - Feb 2015
John A. Walsh
 
PDF
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
LinnAlexandra
 
PPT
WordPress for Libraries PreConference Workshop
Polly Farrington
 
PDF
Using Wordpress with Reclaim Hosting
Cindy Royal
 
PPT
Internet Librarian Slides
Polly Farrington
 
Wordpress workflow for an agency world
Chris Lowe
 
WordPress Theme Design - Rich Media Institute Workshop
Brendan Sera-Shriar
 
Newbies guide to customizing word press themes 25
New Tricks
 
Most widely used WordPress tips and tricks of 2016
Reegan
 
WordPress Sunshine Coast Customizer
Cameron Jones
 
Writing your own WordPress themes and plugins
Stephanie Wells
 
Build a WordPress theme from HTML5 template @ Telerik
Mario Peshev
 
WordPress 2.5 Overview - Rich Media Institute
Brendan Sera-Shriar
 
Easy Guide to WordPress Theme Integration
Sankhala Info Solutions
 
WordPress Developers Israel Meetup #1
Yoav Farhi
 
Overview on WordPress theme file structure and working functionality
Rakesh Kushwaha
 
Optimizing The WordPress Admin For Users
👩🏻‍💻 Cristina Robinson (She/Her)
 
A2WPress Appointway Theme Documentation
A2WPress
 
Editing Wordpress in Dreamweaver
Garin Kilpatrick
 
Make WordPress Themes
Alison Foxall
 
Managing WordPress Websites - Training Course - Feb 2015
John A. Walsh
 
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
LinnAlexandra
 
WordPress for Libraries PreConference Workshop
Polly Farrington
 
Using Wordpress with Reclaim Hosting
Cindy Royal
 
Internet Librarian Slides
Polly Farrington
 
Ad

More from Yogesh singh (8)

PDF
Drag and drop file upload with Dropzone in CodeIgniter
Yogesh singh
 
PDF
Check username availability with vue.js and PHP
Yogesh singh
 
PDF
Copy text to clipboard using vue-clipboard2 - Vue.js
Yogesh singh
 
PDF
How to Create and Load Model in Laravel
Yogesh singh
 
PDF
Create custom 404 error page in CodeIgniter
Yogesh singh
 
PDF
How to Schedule Posts in Wordpress without Plugin
Yogesh singh
 
PDF
An introduction to AngularJS
Yogesh singh
 
PDF
How to verify a domain in MailChimp
Yogesh singh
 
Drag and drop file upload with Dropzone in CodeIgniter
Yogesh singh
 
Check username availability with vue.js and PHP
Yogesh singh
 
Copy text to clipboard using vue-clipboard2 - Vue.js
Yogesh singh
 
How to Create and Load Model in Laravel
Yogesh singh
 
Create custom 404 error page in CodeIgniter
Yogesh singh
 
How to Schedule Posts in Wordpress without Plugin
Yogesh singh
 
An introduction to AngularJS
Yogesh singh
 
How to verify a domain in MailChimp
Yogesh singh
 
Ad

Recently uploaded (20)

PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PDF
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
PPTX
QUARTER 1 WEEK 2 PLOT, POV AND CONFLICTS
KynaParas
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PDF
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PPTX
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PDF
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PDF
Horarios de distribuciĂłn de agua en julio
pegazohn1978
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
QUARTER 1 WEEK 2 PLOT, POV AND CONFLICTS
KynaParas
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
Dimensions of Societal Planning in Commonism
StefanMz
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
Horarios de distribuciĂłn de agua en julio
pegazohn1978
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 

How to create Custom Page Template in WordPress

  • 1. How to Create Custom Page Template in WordPress By Makitweb
  • 2. In WordPress, you can easily customize the page by editing the page.php file of the active theme. But the change will affect on all pages where no need of customization. You can avoid this by creating the custom page template. Using this you can design different-different layout for the pages and add extra content to it without affecting regular pages on the site.
  • 3. Contents - 1. Create Template file 2. Apply Template 3. Conclusion
  • 4. 1. Create Template file â—Ź Navigate to your active theme directory e.g. – twentyseventeen. â—Ź Here, create a new directory page-template to store template files.
  • 6. â—Ź Open contactpage.php. â—Ź Create a new contactpage.php file inside page-template/ directory. You can rename the page to something meaningful name if you want.
  • 7. Add code To tell the WordPress that this file is a template file by adding the following code at the top and save it. Now the following template name visible on the WordPress Dashboard page template section. <?php /* Template Name: Contact page Template */ Add some more code and create a contact form.
  • 8. <?php /* Template Name: Contact page Template */ get_header(); ?> <style> input[type=text], textarea { width: 100%; padding: 12px; border: 1px solid #ccc; margin-top: 6px; margin-bottom: 16px; resize: vertical; } input[type=submit] { background-color: #007eff; color: white; padding: 12px 20px; border: none; border-radius: 4px; cursor: pointer; } .container { border-radius: 5px; background-color: #f2f2f2; padding: 20px; } </style> FULL CODE -
  • 9. <div class="wrap"> <h3>Contact Us</h3> <div class="container"> <form action=""> <label for="fname">First Name</label> <input type="text" id="fname" name="firstname" placeholder="Your name.."> <label for="lname">Last Name</label> <input type="text" id="lname" name="lastname" placeholder="Your last name.."> <label for="subject">Subject</label> <textarea id="subject" name="subject" placeholder="Write something.." style="height:200px"></textarea> <input type="submit" value="Submit"> </form> </div> </div><!-- wrap → <?php get_footer();
  • 10. 2. Apply Template â—Ź Login to Admin Dashboard and navigate to Pages->Add new or Edit an existing page. â—Ź Template list display in Page Attributes section. â—Ź Select Contact page Template option from the dropdown.
  • 12. â—Ź Save and View the page.
  • 13. 3. Conclusion It is better to use custom templates if you only want to customize specific pages. You can create separate page-template for multiple pages.
  • 14. Share For More WordPress related tutorial as well as other programming tutorials visit : Makitweb.com