[wp-trac] [WordPress Trac] #30971: Widgets link in front-end admin bar should point to Widgets in the Customizer

WordPress Trac noreply at wordpress.org
Thu May 21 18:19:06 UTC 2015


#30971: Widgets link in front-end admin bar should point to Widgets in the
Customizer
---------------------------------------------+-----------------------------
 Reporter:  celloexpressions                 |       Owner:  SergeyBiryukov
     Type:  enhancement                      |      Status:  closed
 Priority:  normal                           |   Milestone:  4.2
Component:  Customize                        |     Version:  3.9
 Severity:  normal                           |  Resolution:  fixed
 Keywords:  good-first-bug has-patch commit  |     Focuses:  ui
---------------------------------------------+-----------------------------

Comment (by SergeyBiryukov):

 Here's a snippet to restore non-Customizer links to themes and widgets in
 the toolbar:
 {{{
 function wp30971_replace_themes_and_widgets_links_in_admin_bar(
 $wp_admin_bar ) {
         if ( current_user_can( 'switch_themes' ) ) {
                 $wp_admin_bar->remove_menu( 'customize-themes' );

                 $wp_admin_bar->add_menu( array(
                         'parent' => 'appearance',
                         'id'     => 'themes',
                         'title'  => __( 'Themes' ),
                         'href'   => admin_url( 'themes.php' ),
                         'meta'   => array(
                                 'class' => '',
                         ),
                 ) );
         }

         if ( ! current_user_can( 'edit_theme_options' ) ) {
                 return;
         }

         if ( current_theme_supports( 'widgets' )  ) {
                 $wp_admin_bar->remove_menu( 'customize-widgets' );

                 $wp_admin_bar->add_menu( array(
                         'parent' => 'appearance',
                         'id'     => 'widgets',
                         'title'  => __( 'Widgets' ),
                         'href'   => admin_url( 'widgets.php' ),
                         'meta'   => array(
                                 'class' => '',
                         ),
                 ) );
         }
 }
 add_action( 'admin_bar_menu',
 'wp30971_replace_themes_and_widgets_links_in_admin_bar', 100 );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30971#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list