Skip to content

Instantly share code, notes, and snippets.

@tekapo
Forked from gatespace/view_template_files.php
Last active December 11, 2015 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tekapo/4529793 to your computer and use it in GitHub Desktop.
Save tekapo/4529793 to your computer and use it in GitHub Desktop.
hookをwp_footerにしてみた。
/*
WordPressのテーマにおいて、テンプレート階層に基づきどのテンプレートファイルが使われているか書き出すコード。
ただし、header.php や get_template_part などでインクルードされているファイルを除く。
フックする場所をwp_footerにしてみた。
*/
if ( !function_exists( 'view_template_files' ) ):
function view_template_files() {
if (WP_DEBUG) {
global $template;
echo '<code style="position: absolute; top: 30px; right: 0; z-index: 9999;">'.$template."</code>";
}
}
endif;
add_action('wp_footer', 'view_template_files');
@gatespace
Copy link

あ、なるほど。そこにフックした方がどのテーマでも使えそうです。
私の方にマージしても良いですか?

@tekapo
Copy link
Author

tekapo commented May 21, 2013

あ、コメント見逃してました。もちろんいいです!

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