using page templates in php code example
Example: display page template using functions.php
function define_current_theme_file( $template ) {
$GLOBALS['current_theme_template'] = basename($template);
return $template;
}
add_action('template_include', 'define_current_theme_file', 1000);
# Echo result in header.php
echo $GLOBALS['current_theme_template'];