Title: [Plugin: Toolbar Theme Switcher] PATCH show current theme name, current template
Last modified: August 20, 2016

---

# [Plugin: Toolbar Theme Switcher] PATCH show current theme name, current template

 *  Resolved [lkraav](https://wordpress.org/support/users/lkraav/)
 * (@lkraav)
 * [14 years ago](https://wordpress.org/support/topic/plugin-toolbar-theme-switcher-patch-show-current-theme-name-current-template/)
 *     ```
       commit 39ee9c234abb38aaf67cd0abe3344b1ec6cc53c2
       Author: Leho Kraav <leho@kraav.com>
       Date:   Fri May 4 09:33:15 2012 -0400
   
           show current theme name in admin bar node
   
           we need to know $current before adding node, therefore we're moving it up
   
       diff --git a/toolbar-theme-switcher.php b/toolbar-theme-switcher.php
       index aa4ddfe..05c7e6c 100644
       --- a/toolbar-theme-switcher.php
       +++ b/toolbar-theme-switcher.php
       @@ -191,13 +191,14 @@ class Toolbar_Theme_Switcher {
            */
           static function admin_bar_menu( $wp_admin_bar ) {
   
       +       $themes  = self::get_allowed_themes();
       +       $current = ! empty( self::$theme_name ) ? self::$theme_name : get_option( 'current_theme' );
       +
               $wp_admin_bar->add_node( array(
                   'id'        => 'toolbar_theme_switcher',
       -           'title' => 'Theme'
       +           'title' => 'Theme: ' . $current,
               ) );
   
       -       $themes  = self::get_allowed_themes();
       -       $current = ! empty( self::$theme_name ) ? self::$theme_name : get_option( 'current_theme' );
   
               foreach ( $themes as $theme ) {
   
       commit fc5b37ec22cfab997467a040c5f5befc73e0fd5a
       Author: Leho Kraav <leho@kraav.com>
       Date:   Fri May 4 09:35:45 2012 -0400
   
           add a new node, showing currently used template name
   
           this could be made a plugin option for those that don't need it? i find this
           info invaluable, since it's often very difficult to tell what template wordpress
           arrived at.
   
       diff --git a/toolbar-theme-switcher.php b/toolbar-theme-switcher.php
       index 05c7e6c..c68ea9b 100644
       --- a/toolbar-theme-switcher.php
       +++ b/toolbar-theme-switcher.php
       @@ -190,6 +190,7 @@ class Toolbar_Theme_Switcher {
            * @param WP_Admin_Bar $wp_admin_bar
            */
           static function admin_bar_menu( $wp_admin_bar ) {
       +        global $template;
   
               $themes  = self::get_allowed_themes();
               $current = ! empty( self::$theme_name ) ? self::$theme_name : get_option( 'current_theme' );
       @@ -199,6 +200,13 @@ class Toolbar_Theme_Switcher {
                   'title' => 'Theme: ' . $current,
               ) );
   
       +        $template_file = basename( $template );
       +        $template_dir = basename( dirname( $template ) );
       +
       +       $wp_admin_bar->add_node( array(
       +           'id'        => 'toolbar_theme_switcher_template',
       +           'title' => $template_dir . '/' . $template_file,
       +       ) );
   
               foreach ( $themes as $theme ) {
       ```
   
 * [http://wordpress.org/extend/plugins/toolbar-theme-switcher/](http://wordpress.org/extend/plugins/toolbar-theme-switcher/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Andrey “Rarst” Savchenko](https://wordpress.org/support/users/rarst/)
 * (@rarst)
 * [14 years ago](https://wordpress.org/support/topic/plugin-toolbar-theme-switcher-patch-show-current-theme-name-current-template/#post-2728436)
 * Version 1.1 released
 * [http://wordpress.org/extend/plugins/toolbar-theme-switcher/changelog/](http://wordpress.org/extend/plugins/toolbar-theme-switcher/changelog/)
 * 1. Theme name now shown in toolbar, as per your suggestion.
    2. I think technical
   template details are not in scope for this plugin (I hate those bits all over
   different pieces of code, thinking about making comprehensive context plugin),
   but I’ve added `tts_root_title` filter so you can add that after title without
   having to fork or subclass.

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Toolbar Theme Switcher] PATCH show current theme name, current
template’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/toolbar-theme-switcher_fefefe.svg)
 * [Toolbar Theme Switcher](https://wordpress.org/plugins/toolbar-theme-switcher/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/toolbar-theme-switcher/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/toolbar-theme-switcher/)
 * [Active Topics](https://wordpress.org/support/plugin/toolbar-theme-switcher/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/toolbar-theme-switcher/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/toolbar-theme-switcher/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Andrey “Rarst” Savchenko](https://wordpress.org/support/users/rarst/)
 * Last activity: [14 years ago](https://wordpress.org/support/topic/plugin-toolbar-theme-switcher-patch-show-current-theme-name-current-template/#post-2728436)
 * Status: resolved