Show Current Template - Version 0.2.0

Version Description

None so far.

Download this release

Release Info

Developer tai
Plugin Icon Show Current Template
Version 0.2.0
Comparing to
See all releases

Version 0.2.0

README.md ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ Show Current Template
2
+ ==========
3
+
4
+ A WordPress plugin which shows the current template file name, the current theme name and included template files' name in the tool bar.
languages/show-current-template-ja.mo ADDED
Binary file
languages/show-current-template-ja.po ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2013
2
+ # This file is distributed under the same license as the package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: sct9\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/shwo-current-template\n"
7
+ "POT-Creation-Date: 2013-05-21 09:44:12+00:00\n"
8
+ "PO-Revision-Date: 2013-05-21 18:44+0900\n"
9
+ "Last-Translator: JOTAKI, Taisuke <tekapo@gmail.com>\n"
10
+ "Language-Team: \n"
11
+ "Language: Japanese\n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+ "X-Generator: Poedit 1.5.5\n"
16
+
17
+ #: show-current-template.php:61 show-current-template.php:65
18
+ msgid "Theme name: "
19
+ msgstr "テーマ名: "
20
+
21
+ #: show-current-template.php:62
22
+ msgid "'s child"
23
+ msgstr " の子テーマです"
24
+
25
+ #: show-current-template.php:65
26
+ msgid "NOT a child theme"
27
+ msgstr "子テーマではありません"
28
+
29
+ #: show-current-template.php:81
30
+ msgid "Template:"
31
+ msgstr "テンプレート: "
32
+
33
+ #: show-current-template.php:89
34
+ msgid "Template relative path:"
35
+ msgstr "テンプレート相対パス: "
36
+
37
+ #: show-current-template.php:101
38
+ msgid "Also, below template files are included:"
39
+ msgstr "また、次のテンプレートファイルもインクルードされています:"
40
+
41
+ #~ msgid "ALSO including:"
42
+ #~ msgstr "次のファイルも含まれています: "
languages/shwo-current-template.pot ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2013
2
+ # This file is distributed under the same license as the package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: \n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/shwo-current-template\n"
7
+ "POT-Creation-Date: 2013-05-21 09:44:12+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+
15
+ #: show-current-template.php:61 show-current-template.php:65
16
+ msgid "Theme name: "
17
+ msgstr ""
18
+
19
+ #: show-current-template.php:62
20
+ msgid "'s child"
21
+ msgstr ""
22
+
23
+ #: show-current-template.php:65
24
+ msgid "NOT a child theme"
25
+ msgstr ""
26
+
27
+ #: show-current-template.php:81
28
+ msgid "Template:"
29
+ msgstr ""
30
+
31
+ #: show-current-template.php:89
32
+ msgid "Template relative path:"
33
+ msgstr ""
34
+
35
+ #: show-current-template.php:101
36
+ msgid "Also, below template files are included:"
37
+ msgstr ""
readme.txt ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Show Current Template ===
2
+ Contributors: tai
3
+ Donate link:
4
+ Tags: template, toolbar
5
+ Requires at least: 3.5
6
+ Tested up to: 4.4
7
+ Stable tag: 0.2.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+
12
+ == Description ==
13
+ A WordPress plugin which shows the current template file name, the current theme name and included template files' name in the tool bar.
14
+
15
+ Inspired by (and big thanks to):
16
+
17
+ * https://gist.github.com/gatespace/4482529
18
+ * http://wordpress.org/plugins/reveal-template/
19
+
20
+
21
+ == Installation ==
22
+
23
+ = The Good Way =
24
+
25
+ 1. In your WordPress Admin, go to the Add New Plugins page
26
+ 1. Search for: Show Current Template
27
+ 1. Show Current Template should be the first result. Click the Install link.
28
+
29
+ = The Old Way =
30
+
31
+ 1. Upload the plugin to the `/wp-content/plugins/` directory
32
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
33
+
34
+ == Frequently Asked Questions ==
35
+
36
+ None so far.
37
+
38
+ == Screenshots ==
39
+
40
+ 1. Shows the current template file.
41
+
42
+ == Upgrade Notice ==
43
+
44
+ None so far.
45
+
46
+ == Changelog ==
47
+
48
+ = 0.1.8 =
49
+ * UPDATED: update for 3.8.
50
+
51
+ = 0.1.6 =
52
+ * FIXED: update for 3.8.
53
+
54
+ = 0.1.5 =
55
+ * FIXED: Fixed the issue of not displaying the parent theme name when using a child theme.
56
+
57
+ = 0.1.4 =
58
+ * UPDATED: Make not to show the current file in the included files list.
59
+
60
+ = 0.1.3 =
61
+ * FIXED: Fixed some notices.
62
+
63
+ = 0.1.2 =
64
+ * FIXED: Fixed potential conflict text domain (https://github.com/tekapo/show-current-template/pull/1).
65
+ Thanks to @wokamoto san.
66
+
67
+ = 0.1.1 =
68
+ * UPDATED: readme.txt
69
+
70
+ = 0.1.0 =
71
+ * Initial release
show-current-template.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ Plugin Name: Show Current Template
5
+ Plugin URI: http://wp.tekapo.com/
6
+ Description: Show the current template file name in the tool bar.
7
+ Author: JOTAKI Taisuke
8
+ Version: 0.2.0
9
+ Author URI: http://tekapo.com/
10
+ Text Domain: show-current-template
11
+ Domain Path: /languages/
12
+
13
+ License:
14
+ Released under the GPL license
15
+ http://www.gnu.org/copyleft/gpl.html
16
+
17
+ Copyright 2013 (email : tekapo@gmail.com)
18
+
19
+ This program is free software; you can redistribute it and/or modify
20
+ it under the terms of the GNU General Public License as published by
21
+ the Free Software Foundation; either version 2 of the License, or
22
+ (at your option) any later version.
23
+
24
+ This program is distributed in the hope that it will be useful,
25
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
26
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
+ GNU General Public License for more details.
28
+
29
+ You should have received a copy of the GNU General Public License
30
+ along with this program; if not, write to the Free Software
31
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32
+ */
33
+
34
+ load_plugin_textdomain( Show_Template_File_Name::TEXT_DOMAIN, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
35
+
36
+ new Show_Template_File_Name();
37
+
38
+ class Show_Template_File_Name {
39
+
40
+ const TEXT_DOMAIN = 'show-current-template';
41
+
42
+ function __construct() {
43
+ add_action( "admin_bar_menu", array( &$this, "show_template_file_name_on_top" ), 9999 );
44
+ add_action( 'wp_enqueue_scripts', array( &$this, "add_current_template_stylesheet" ), 9999 );
45
+ }
46
+
47
+ public function show_template_file_name_on_top( $wp_admin_bar ) {
48
+
49
+ if ( is_admin() or !is_super_admin() )
50
+ return;
51
+
52
+ global $template;
53
+
54
+ $template_file_name = basename( $template );
55
+ $template_relative_path = str_replace( ABSPATH . 'wp-content/', '', $template );
56
+
57
+ $current_theme = wp_get_theme();
58
+ $current_theme_name = $current_theme->Name;
59
+ $parent_theme_name = '';
60
+
61
+ if ( is_child_theme() ) {
62
+ $child_theme_name = __( 'Theme name: ', self::TEXT_DOMAIN, 'show-current-template' )
63
+ . $current_theme_name;
64
+ $parent_theme_name = $current_theme->parent()->Name;
65
+ $parent_theme_name = ' (' . $parent_theme_name . __( "'s child", self::TEXT_DOMAIN, 'show-current-template' ) . ")";
66
+ $parent_or_child = $child_theme_name . $parent_theme_name;
67
+ } else {
68
+ $parent_or_child = __( 'Theme name: ', self::TEXT_DOMAIN, 'show-current-template' )
69
+ . $current_theme_name . ' (' . __( 'NOT a child theme', self::TEXT_DOMAIN, 'show-current-template' ) . ')';
70
+ }
71
+
72
+ $included_files = get_included_files();
73
+
74
+ sort( $included_files );
75
+ $included_files_list = '';
76
+ foreach ( $included_files as $filename ) {
77
+ if ( strstr( $filename, 'themes' ) ) {
78
+ $filepath = strstr( $filename, 'themes' );
79
+ if ( $template_relative_path == $filepath ) {
80
+ $included_files_list .= '';
81
+ } else {
82
+ $included_files_list .= '<li>' . "$filepath" . '</li>';
83
+ }
84
+ }
85
+ }
86
+
87
+ global $wp_admin_bar;
88
+ $args = array(
89
+ 'id' => 'show_template_file_name_on_top',
90
+ 'title' => __( 'Template:', self::TEXT_DOMAIN, 'show-current-template' )
91
+ . '<span class="show-template-name"> ' . $template_file_name . '</span>',
92
+ );
93
+
94
+ $wp_admin_bar->add_node( $args );
95
+
96
+ $wp_admin_bar->add_menu( array(
97
+ 'parent' => 'show_template_file_name_on_top',
98
+ 'id' => 'template_relative_path',
99
+ 'title' => __( 'Template relative path:', self::TEXT_DOMAIN, 'show-current-template' )
100
+ . '<span class="show-template-name"> ' . $template_relative_path . '</span>',
101
+ ) );
102
+
103
+ $wp_admin_bar->add_menu( array(
104
+ 'parent' => 'show_template_file_name_on_top',
105
+ 'id' => 'is_child_theme',
106
+ 'title' => $parent_or_child,
107
+ ) );
108
+
109
+ $wp_admin_bar->add_menu( array(
110
+ 'parent' => 'show_template_file_name_on_top',
111
+ 'id' => 'included_files_path',
112
+ 'title' => __( 'Also, below template files are included:', self::TEXT_DOMAIN
113
+ , 'show-current-template' ) . '<br /><ul id="included-files-list">'
114
+ . $included_files_list . '</ul>',
115
+ ) );
116
+ }
117
+
118
+ public function add_current_template_stylesheet() {
119
+
120
+ if ( is_admin() or !is_super_admin() ) {
121
+ return;
122
+ }
123
+
124
+ $wp_version = get_bloginfo( 'version' );
125
+
126
+ if ( $wp_version >= '3.8' ) {
127
+ wp_register_style( 'current-template-style', plugins_url( 'style.css', __FILE__ ) );
128
+ wp_enqueue_style( 'current-template-style' );
129
+ } else {
130
+ wp_register_style( 'current-template-style', plugins_url( 'style-old.css', __FILE__ ) );
131
+ wp_enqueue_style( 'current-template-style' );
132
+ }
133
+ }
134
+
135
+ }
show-current-template.pot ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2013
2
+ # This file is distributed under the same license as the package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: \n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/show-current-template1\n"
7
+ "POT-Creation-Date: 2013-12-23 07:57:23+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+
15
+ #: show-current-template.php:62 show-current-template.php:68
16
+ msgid "Theme name: "
17
+ msgstr ""
18
+
19
+ #: show-current-template.php:65
20
+ msgid "'s child"
21
+ msgstr ""
22
+
23
+ #: show-current-template.php:69
24
+ msgid "NOT a child theme"
25
+ msgstr ""
26
+
27
+ #: show-current-template.php:90
28
+ msgid "Template:"
29
+ msgstr ""
30
+
31
+ #: show-current-template.php:99
32
+ msgid "Template relative path:"
33
+ msgstr ""
34
+
35
+ #: show-current-template.php:112
36
+ msgid "Also, below template files are included:"
37
+ msgstr ""
style-old.css ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Document : style.css
3
+ Created on : 2013/01/21, 16:04:46
4
+ Updated on : 2014/01/26, 22:28
5
+ Author : tai
6
+ Description:
7
+ The stylesheet for the plugin.
8
+ */
9
+
10
+ #wpadminbar .show-template-name,
11
+ #wpadminbar .hover .show-template-name,
12
+ #wpadminbar #wp-admin-bar-included_files_path .ab-item div {
13
+ font-family: monospace;
14
+ text-shadow: none;
15
+ }
16
+
17
+ #wpadminbar #wp-admin-bar-included_files_path .ab-item {
18
+ height: auto;
19
+ }
20
+
21
+ #wpadminbar .show-template-name {
22
+ color: #ccc;
23
+ }
24
+
25
+ #wpadminbar #included-files-list li,
26
+ #wpadminbar .menupop.hover .show-template-name {
27
+ color: #333;
28
+ }
29
+
30
+ #wpadminbar #included-files-list li {
31
+ margin-left: 20px;
32
+ text-shadow: none;
33
+ }
style.css ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Document : style.css
3
+ Created on : 2013/01/21, 16:04:46
4
+ Updated on : 2014/01/26, 23:16
5
+ Author : tai
6
+ Description:
7
+ The stylesheet for the plugin.
8
+ */
9
+
10
+ #wpadminbar .show-template-name,
11
+ #wpadminbar .hover .show-template-name,
12
+ #wpadminbar #wp-admin-bar-included_files_path .ab-item div {
13
+ font-family: monospace;
14
+ text-shadow: none;
15
+ }
16
+
17
+ #wpadminbar #wp-admin-bar-included_files_path .ab-item {
18
+ height: auto;
19
+ }
20
+
21
+ #wpadminbar #wp-admin-bar-included_files_path .ab-item div {
22
+ color: #fff;
23
+ }
24
+
25
+ #wpadminbar .hover .show-template-name:hover,
26
+ #wpadminbar #wp-admin-bar-included_files_path .ab-item #included-files-list li:hover {
27
+ color: #2ea2cc;
28
+ }
29
+
30
+ #wpadminbar #included-files-list {
31
+ margin-left: 20px;
32
+ }