WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Toolbar Theme Switcher] PATCH show current theme name, current template

[Resolved] [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/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] [Plugin: Toolbar Theme Switcher] PATCH show current theme name, current template’ is closed to new replies.