Make WordPress Core

Changeset 16078


Ignore:
Timestamp:
10/29/2010 03:26:36 PM (13 years ago)
Author:
ryan
Message:

Add Appearance menu to admin bar. see #14772

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/admin-bar.php

    r16077 r16078  
    226226    // @todo styling for awaiting mod count. Don't show count if zero?
    227227    $wp_admin_bar->add_menu( array( 'id' => 'comments', 'title' => sprintf( __('Comments %s'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='pending-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'href' => admin_url('comments.php') ) );
     228}
     229
     230function wp_admin_bar_appearance_menu() {
     231    global $wp_admin_bar;
     232
     233    if ( !current_user_can('switch themes') )
     234        return;
     235
     236    $wp_admin_bar->add_menu( array( 'id' => 'appearance', 'title' => __('Appearance'), 'href' => admin_url('themes.php') ) );
     237
     238    if ( !current_user_can('edit_theme_options') )
     239        return;
     240
     241    if ( current_theme_supports( 'widgets' )  )
     242        $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'widgets', 'title' => __('Widgets'), 'href' => admin_url('widgets.php') ) );
     243
     244     if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
     245        $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'menus', 'title' => __('Menus'), 'href' => admin_url('nav-menus.php') ) );
    228246}
    229247
  • trunk/wp-includes/admin-bar/admin-bar-class.php

    r16077 r16078  
    182182        add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_new_content_menu', 50 );
    183183        add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_comments_menu', 60 );
    184         add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_shortlink_menu', 70 );
     184        add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_appearance_menu', 70 );
     185        add_action( 'wp_before_admin_bar_render', 'wp_admin_bar_shortlink_menu', 80 );
    185186       
    186187        if ( is_multisite() && is_super_admin() && function_exists('wp_admin_bar_superadmin_settings_menu') )
Note: See TracChangeset for help on using the changeset viewer.