WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get page template

Description

Retrieve path of page template in current or parent template.

First attempt is to look for the file in the '_wp_page_template' page meta data. The second attempt, if the first has a file and is not empty, is to look for 'page.php'.

Usage

<?php get_page_template(); ?>

Parameters

None.

Return Values

(string) 
Returns path of page template in current or parent template.

Examples

Displays the filename of the page template used to render a Page (printed within an HTML comment, in this example) :

<?php echo '<!-- ' . basename( get_page_template() ) . ' -->'; ?>

Notes

Change Log

Since: 1.5.0

Source File

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

Related

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