-
-
Save tekapo/4529793 to your computer and use it in GitHub Desktop.
hookをwp_footerにしてみた。
This file contains hidden or 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
/* | |
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'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
あ、なるほど。そこにフックした方がどのテーマでも使えそうです。
私の方にマージしても良いですか?