Last active
April 12, 2023 06:20
-
-
Save maddisondesigns/896f1d4c83a6b06a3c3dd51af3dc89d9 to your computer and use it in GitHub Desktop.
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;z-index:9999;position:absolute;top:0;">'; | |
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