display page template using functions php

Solutions on MaxInterview for display page template using functions php by the best coders in the world

showing results for - "display page template using functions php"
Marceau
29 Sep 2019
1function define_current_theme_file( $template ) {
2    $GLOBALS['current_theme_template'] = basename($template);
3
4    return $template;
5}
6add_action('template_include', 'define_current_theme_file', 1000);
7
8# Echo result in header.php
9echo $GLOBALS['current_theme_template'];