Make WordPress Core

Ticket #30971: admin-bar.diff

File admin-bar.diff, 1.4 KB (added by caseypatrickdriscoll, 11 years ago)

patch

  • wp-includes/admin-bar.php

     
    683683                add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' );
    684684        }
    685685
    686         if ( current_theme_supports( 'widgets' )  )
    687                 $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'widgets', 'title' => __('Widgets'), 'href' => admin_url('widgets.php') ) );
     686        if ( current_theme_supports( 'widgets' )  ) {
     687                $wp_admin_bar->add_menu( array(
     688                        'parent' => 'appearance',
     689                        'id'     => 'widgets',
     690                        'title'  => __( 'Widgets' ),
     691                        'href'   => admin_url( 'widgets.php' ),
     692                        'meta'   => array(
     693                                'class' => 'hide-if-customize',
     694                        ),
     695                ) );
    688696
     697                if ( current_user_can( 'customize' ) ) {
     698                        $wp_admin_bar->add_menu( array(
     699                                'parent' => 'appearance',
     700                                'id'     => 'customize-widgets',
     701                                'title'  => __( 'Widgets' ),
     702                                'href'   => add_query_arg( urlencode( 'autofocus[panel]' ), 'widgets', $customize_url ), // urlencode() needed due to #16859
     703                                'meta'   => array(
     704                                        'class' => 'hide-if-no-customize',
     705                                ),
     706                        ) );
     707                }
     708
     709
     710        }
     711
    689712        if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
    690713                $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'menus', 'title' => __('Menus'), 'href' => admin_url('nav-menus.php') ) );
    691714