Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Display the name of the current WordPress template being used
<?php
/**
* Debug function to show the name of the current template being used
*/
function mytheme_show_template() {
global $template;
if ( is_user_logged_in() ) {
echo '<div style="background-color:#000;color:#fff">';
print_r( $template );
if ( is_single() ) {
echo ' (and using Post Format: ' . ucfirst( get_post_format() ? get_post_format() : 'standard' ) . ')';
}
echo '</div>';
}
}
add_action( 'wp_head', 'mytheme_show_template' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.