A custom page template is a special PHP file in a WordPress theme that lets you create a unique layout or design for a specific page, different from the default page layout.
Click to reveal answer
beginner
How do you tell WordPress that a PHP file is a custom page template?
You add a comment at the top of the PHP file like this: /* Template Name: Your Template Name */ This makes WordPress recognize it as a selectable template in the page editor.
Click to reveal answer
beginner
Where do you place custom page template files in a WordPress theme?
You place custom page template files inside your active theme folder, usually in the root or a subfolder like /templates/. WordPress looks for them there to list in the page editor.
Click to reveal answer
beginner
How do you apply a custom page template to a page in WordPress?
In the WordPress admin, edit the page you want to customize. On the right side under 'Page Attributes', find the 'Template' dropdown and select your custom template. Then save or update the page.
Click to reveal answer
intermediate
Can custom page templates include custom PHP code and HTML?
Yes! Custom page templates can have any PHP, HTML, CSS, or JavaScript you want. This lets you create special layouts, add custom content, or change how the page looks and works.
Click to reveal answer
What comment must be added at the top of a PHP file to make it a custom page template in WordPress?
A// Template: My Template
B# Template Name: My Template
C<!-- Template: My Template -->
D/* Template Name: My Template */
✗ Incorrect
The correct syntax is a PHP comment with 'Template Name' like /* Template Name: My Template */.
Where do you select a custom page template for a page in WordPress?
AIn the 'Page Attributes' box on the page editor screen
BIn the WordPress theme customizer
CIn the WordPress menu settings
DIn the WordPress widgets area
✗ Incorrect
Custom page templates are selected in the 'Page Attributes' box when editing a page.
Which folder should custom page template files be placed in?
AIn the WordPress plugins folder
BInside the active theme folder
CIn the WordPress uploads folder
DAnywhere on the server
✗ Incorrect
Custom page templates must be inside the active theme folder to be recognized.
Can a custom page template contain PHP code?
AYes, it can contain PHP, HTML, CSS, and JavaScript
BNo, it can only contain HTML
COnly CSS is allowed
DOnly JavaScript is allowed
✗ Incorrect
Custom page templates can include PHP, HTML, CSS, and JavaScript to customize the page fully.
What happens if you don’t assign a custom page template to a page?
AThe page will use the blog post template
BThe page will not display
CThe page uses the default page template
DWordPress will show an error
✗ Incorrect
If no custom template is assigned, WordPress uses the default page template for that page.
Explain how to create and use a custom page template in WordPress.
Think about the steps from file creation to applying the template in the admin.
You got /4 concepts.
Why would you want to use a custom page template in WordPress?
Consider why different pages might need different looks or functions.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of a custom page template in WordPress?
easy
A. To create a unique layout for a specific page
B. To change the WordPress admin dashboard style
C. To add new plugins automatically
D. To backup the website content
Solution
Step 1: Understand what a page template does
A custom page template allows you to design a different layout or look for a specific page.
Step 2: Compare options to the purpose
Only To create a unique layout for a specific page describes creating a unique layout for a page, which matches the purpose of custom page templates.
Final Answer:
To create a unique layout for a specific page -> Option A
Quick Check:
Custom page template = unique page layout [OK]
Hint: Custom templates change page look, not admin or backups [OK]
Common Mistakes:
Confusing templates with plugins
Thinking templates change admin dashboard
Believing templates backup content
2. Which of the following is the correct way to start a custom page template file in WordPress?
easy
A.
B.
C.
D.
Solution
Step 1: Recall the required comment format
WordPress requires a PHP comment with "Template Name:" inside the file to recognize a custom page template.
Step 2: Identify the correct syntax
uses the correct PHP comment format: .
Final Answer:
-> Option C
Quick Check:
Template comment must be PHP block comment with 'Template Name:' [OK]
Hint: Use PHP block comment with 'Template Name:' exactly [OK]
Common Mistakes:
Using HTML comments instead of PHP comments
Writing 'Page Template' instead of 'Template Name'
Using single-line comments that WordPress ignores
3. Given this custom page template header:
<?php
/* Template Name: Special Layout */
?>
What happens when you assign this template to a page in WordPress?
medium
A. The page uses the default theme layout
B. The page uses the 'Special Layout' template for its design
C. The page becomes inaccessible
D. The template is ignored and a 404 error shows
Solution
Step 1: Understand template assignment
Assigning a custom template to a page tells WordPress to use that template's layout for rendering the page.
Step 2: Match template name to page behavior
The template named 'Special Layout' will be used to display the page, overriding the default layout.
Final Answer:
The page uses the 'Special Layout' template for its design -> Option B
Quick Check:
Assign template = page uses that layout [OK]
Hint: Assigning template changes page layout, not error or default [OK]
Common Mistakes:
Thinking template assignment causes errors
Assuming default layout stays after assignment
Confusing template name with page title
4. You created a custom page template file named custom-template.php with the correct header comment, but it does not appear in the WordPress page editor template dropdown. What is the likely cause?
medium
A. The page editor does not support templates
B. The template name comment is missing
C. The file has a syntax error in PHP code
D. The file is not in the active theme folder
Solution
Step 1: Check template file location
WordPress only detects custom templates inside the active theme's root folder or its subfolders.
Step 2: Eliminate other causes
The question states the header comment is correct, so B is unlikely. Syntax errors might cause errors but usually still show the template. The page editor supports templates by default.
Final Answer:
The file is not in the active theme folder -> Option D
Quick Check:
Template file must be inside active theme folder [OK]
Hint: Place template file inside active theme folder to appear [OK]
Common Mistakes:
Placing template in plugin folder instead of theme
Forgetting to refresh page editor after adding template
Assuming page editor lacks template support
5. You want to create two different custom page templates: one for a full-width layout and one with a sidebar. How should you organize your files and comments to make both templates available and selectable in WordPress?
hard
A. Create two PHP files in the theme folder, each with a unique 'Template Name' comment
B. Create one PHP file with two 'Template Name' comments inside
C. Create two PHP files but only one needs the 'Template Name' comment
D. Create two PHP files in a plugin folder with 'Template Name' comments
Solution
Step 1: Understand template file requirements
Each custom page template must be a separate PHP file with its own unique 'Template Name' comment.
Step 2: Confirm file location and comments
Both files must be inside the active theme folder. Plugins do not register page templates this way by default.
Final Answer:
Create two PHP files in the theme folder, each with a unique 'Template Name' comment -> Option A
Quick Check:
Separate files + unique names = multiple templates [OK]
Hint: One template per file with unique name inside theme folder [OK]
Common Mistakes:
Putting multiple template names in one file
Placing templates outside the theme folder
Assuming plugins auto-register page templates
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.