Show current template file (on frontend)

Show current template file (on frontend)

In the functions.php file add this:
add_action('wp_footer', function() {
    if (current_user_can('administrator')) {
        global $template;
        echo '<!-- Template: ' . basename($template) . ' -->';
    }
});

Ever wonder “which template is this?ˮ Wonder no more. 🕵