📜  使用functions.php代码示例显示页面模板

📅  最后修改于: 2022-03-11 14:54:33.158000             🧑  作者: Mango

代码示例1
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'];