Codex

Function Reference/is page template

Contents

Description

This Conditional Tag checks if a specific Page Template is being used in a Page. This is a boolean function, meaning it returns either TRUE or FALSE.

Usage

<?php is_page_template(); ?>

Parameters

Return Values

(boolean) 
True on success, false on failure.

Examples

Is Page Template 'about' being used? Note that unlike with other conditionals, if you want to specify a particular Page Template, you need to use the filename, such as about.php or my_page_template.php.
<?php 
if ( is_page_template('about.php') ) {
    
// Returns true when 'about.php' is being used.
} else {
    
// Returns false when 'about.php' is not being used.
}
?>

Notes

Change Log

Since: 2.5.0

Source File

is_page_template() is located in wp-includes/post-template.php.

Related

is_home(), is_front_page(), is_search(), is_404(), is_singular(), is_page(), is_attachment(), is_local_attachment(), is_single(), is_sticky(), is_archive(), is_category(), is_tag(), is_author(), is_date(), is_year(), is_month(), is_day(), is_time(), is_admin(), is_preview(), is_paged(), is_page_template(), is plugin active(), is_plugin_page(), is_new_day(), is_feed(), is_trackback(), is_comments_popup(), comments_open(), pings_open(), is_taxonomy(), is_taxonomy_hierarchical(), is_term(), is_user_logged_in(), is_blog_installed(), is_active_sidebar(), is_dynamic_sidebar(), is_active_widget(), in_the_loop(), in_category(), has_tag(), has_excerpt()

See also index of Function Reference and index of Template Tags.