Last active
December 14, 2017 23:27
-
-
Save yayMark/55616d4f1c3bda5d7961e5f34bd91d1a to your computer and use it in GitHub Desktop.
WordPress: display the template in use
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 | |
add_action( 'admin_bar_menu', 'show_template' ); | |
function show_template() { | |
$is_dev = strpos(getenv('APP_ENV'), 'dev') !== false; | |
if ($is_dev) { | |
global $template; | |
print_r( $template ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added a getenv directive so should the code get beyond development environment, it won't show the template name.