Skip to content

Instantly share code, notes, and snippets.

@yayMark
Last active December 14, 2017 23:27
Show Gist options
  • Save yayMark/55616d4f1c3bda5d7961e5f34bd91d1a to your computer and use it in GitHub Desktop.
Save yayMark/55616d4f1c3bda5d7961e5f34bd91d1a to your computer and use it in GitHub Desktop.
WordPress: display the template in use
<?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 );
}
}
@yayMark
Copy link
Author

yayMark commented Dec 14, 2017

Added a getenv directive so should the code get beyond development environment, it won't show the template name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment