Skip to content

Instantly share code, notes, and snippets.

@gatespace
Last active July 30, 2022 22:04
Show Gist options
  • Select an option

  • Save gatespace/4482529 to your computer and use it in GitHub Desktop.

Select an option

Save gatespace/4482529 to your computer and use it in GitHub Desktop.

Revisions

  1. gatespace revised this gist May 23, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion view_template_files.php
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ function view_template_files() {
    $style_top = ( is_admin_bar_showing() ) ? "35px" : "0px";
    echo '<code style="position: fixed; top: ' . $style_top . '; right: 10px; z-index: 9999; background-color: rgba(255, 255, 255, 0.5); padding: 10px; color: #000000; border: solid 2px #000000; ">';
    echo "テーマのディレクトリ名:" . $template_dir;
    echo " テンプレートファイル名:" . $template_name . "</code>";
    echo " テンプレートファイル名:" . $template_name;
    echo "</code>\n";
    }
    }
  2. gatespace revised this gist Jan 22, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion view_template_files.php
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@
    add_action('wp_footer', 'view_template_files');
    if ( !function_exists( 'view_template_files' ) ):
    function view_template_files() {
    if ( WP_DEBUG ) {
    if ( defined('WP_DEBUG') && WP_DEBUG ) {
    global $template;
    $template_name = basename( $template, '.php' );
    $template_dir = basename ( dirname( $template ) );
  3. gatespace revised this gist Jan 17, 2013. 1 changed file with 0 additions and 8 deletions.
    8 changes: 0 additions & 8 deletions view_template_files.php
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,6 @@
    /*
    WordPressのテーマにおいて、テンプレート階層に基づきどのテンプレートファイルが使われているか書き出すコード。
    ただし、header.php や get_template_part などでインクルードされているファイルを除く。
    header.php あたりに do_action( 'before' );があること前提
    2013.1.16
    @wokamoto さんのコードを元に、テンプレートファイル名とテーマフォルダを分かりやすく表記するようにしました。
    https://gist.github.com/4553528
    https://gist.github.com/4553584
    @tekapo さんのコードを元にwp_footer にフックする用に変更しました。
    https://gist.github.com/4529793
    スタイルシート周りを調整しました。
    */

    add_action('wp_footer', 'view_template_files');
  4. gatespace revised this gist Jan 17, 2013. No changes.
  5. gatespace revised this gist Jan 17, 2013. 1 changed file with 11 additions and 3 deletions.
    14 changes: 11 additions & 3 deletions view_template_files.php
    Original file line number Diff line number Diff line change
    @@ -2,19 +2,27 @@
    WordPressのテーマにおいて、テンプレート階層に基づきどのテンプレートファイルが使われているか書き出すコード。
    ただし、header.php や get_template_part などでインクルードされているファイルを除く。
    header.php あたりに do_action( 'before' );があること前提
    2013.1.16 @wokamoto さんのコードを元に、テンプレートファイル名とテーマフォルダを分かりやすく表記するようにしました。
    2013.1.16
    @wokamoto さんのコードを元に、テンプレートファイル名とテーマフォルダを分かりやすく表記するようにしました。
    https://gist.github.com/4553528
    https://gist.github.com/4553584
    @tekapo さんのコードを元にwp_footer にフックする用に変更しました。
    https://gist.github.com/4529793
    スタイルシート周りを調整しました。
    */

    add_action('before', 'view_template_files');
    add_action('wp_footer', 'view_template_files');
    if ( !function_exists( 'view_template_files' ) ):
    function view_template_files() {
    if ( WP_DEBUG ) {
    global $template;
    $template_name = basename( $template, '.php' );
    $template_dir = basename ( dirname( $template ) );
    echo '<code style="position: absolute; top: 35px; right: 0; z-index: 9999;">テーマのディレクトリ名:' . $template_dir. " テンプレートファイル名:" . $template_name . "</code>";
    $style_top = ( is_admin_bar_showing() ) ? "35px" : "0px";
    echo '<code style="position: fixed; top: ' . $style_top . '; right: 10px; z-index: 9999; background-color: rgba(255, 255, 255, 0.5); padding: 10px; color: #000000; border: solid 2px #000000; ">';
    echo "テーマのディレクトリ名:" . $template_dir;
    echo " テンプレートファイル名:" . $template_name . "</code>";
    echo "</code>\n";
    }
    }
    endif;
  6. gatespace revised this gist Jan 17, 2013. 1 changed file with 8 additions and 3 deletions.
    11 changes: 8 additions & 3 deletions view_template_files.php
    Original file line number Diff line number Diff line change
    @@ -2,14 +2,19 @@
    WordPressのテーマにおいて、テンプレート階層に基づきどのテンプレートファイルが使われているか書き出すコード。
    ただし、header.php や get_template_part などでインクルードされているファイルを除く。
    header.php あたりに do_action( 'before' );があること前提
    2013.1.16 @wokamoto さんのコードを元に、テンプレートファイル名とテーマフォルダを分かりやすく表記するようにしました。
    https://gist.github.com/4553528
    https://gist.github.com/4553584
    */

    add_action('before', 'view_template_files');
    if ( !function_exists( 'view_template_files' ) ):
    function view_template_files() {
    if (WP_DEBUG) {
    if ( WP_DEBUG ) {
    global $template;
    echo '<code style="position: absolute; top: 30px; right: 0; z-index: 9999;">'.$template."</code>";
    $template_name = basename( $template, '.php' );
    $template_dir = basename ( dirname( $template ) );
    echo '<code style="position: absolute; top: 35px; right: 0; z-index: 9999;">テーマのディレクトリ名:' . $template_dir. " テンプレートファイル名:" . $template_name . "</code>";
    }
    }
    endif;
    add_action('before', 'view_template_files');
  7. gatespace created this gist Jan 8, 2013.
    15 changes: 15 additions & 0 deletions view_template_files.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    /*
    WordPressのテーマにおいて、テンプレート階層に基づきどのテンプレートファイルが使われているか書き出すコード。
    ただし、header.php や get_template_part などでインクルードされているファイルを除く。
    header.php あたりに do_action( 'before' );があること前提
    */

    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('before', 'view_template_files');