Display the name of the current WordPress template being used
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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