On a Page using template-about.php (true):
<div class="about-wrap">
On a Page using the default template (false):
(nothing is printed)
How It Works
The argument is the template file name.
is_page_template() is true only for Pages that use it.
Other Pages skip the wrapper.
Example 2 — Any custom template
Check if a Page uses a custom template at all.
WordPress
<?php if ( is_page_template() ) {
echo 'This Page uses a custom template.';
} ?>
Output
Page with a custom template (true):
This Page uses a custom template.
Page with the default template (false):
(nothing is printed)
How It Works
With no argument, the tag matches any custom template.
Default pages return false.
It is useful for styling decisions.
Example 3 — Template in a sub-folder
Include the folder in the file name.
WordPress
<?php if ( is_page_template( 'templates/landing.php' ) ) {
// no sidebar on landing pages
} else {
get_sidebar();
} ?>
Output
On a Page using templates/landing.php (true):
(no sidebar is printed)
On other pages (false):
<aside class="widget-area">...</aside>
How It Works
The folder is part of the template name.
The if branch is empty on purpose, so no sidebar is printed.
The else branch calls get_sidebar().
Frequently Asked Questions
It returns true or false (a bool). Use it inside an if statement.
The Page may use the default template, or the name may not match. Check the exact file name and folder.
Yes, if the template file is inside a sub-folder of your theme.
No. is_page() checks the page type. is_page_template() checks which template file the Page uses.
Conditional tags need the main query. Call them in template files or on hooks such as wp or template_redirect, not directly at the top of functions.php.