Changeset 18788 for trunk/wp-includes/admin-bar.php
- Timestamp:
- 09/27/2011 04:04:10 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/admin-bar.php
r18787 r18788 430 430 */ 431 431 function wp_admin_bar_new_content_menu( $wp_admin_bar ) { 432 $primary = array(); 433 $secondary = array(); 432 $primary = $secondary = array(); 434 433 435 434 foreach ( (array) get_post_types( array( 'show_in_admin_bar' => true ), 'objects' ) as $ptype_obj ) { … … 437 436 continue; 438 437 439 $primary[ 'post-new.php?post_type=' . $ptype_obj->name ] = array( $ptype_obj->labels->name_admin_bar, $ptype_obj->cap->edit_posts, 'new-' . $ptype_obj->name ); 438 $key = 'post' == $ptype_obj->name ? 'post-new.php' : 'post-new.php?post_type=' . $ptype_obj->name; 439 $primary[ $key ] = array( $ptype_obj->labels->name_admin_bar, 'new-' . $ptype_obj->name ); 440 440 } 441 441 442 442 if ( current_user_can( 'upload_files' ) ) 443 $primary[ 'media-new.php' ] = array( _x( 'Media', 'add new from admin bar' ), ' upload_files', 'new-media' );443 $primary[ 'media-new.php' ] = array( _x( 'Media', 'add new from admin bar' ), 'new-media' ); 444 444 445 445 if ( current_user_can( 'manage_links' ) ) 446 $primary[ 'link-add.php' ] = array( _x( 'Link', 'add new from admin bar' ), ' manage_links', 'new-link' );446 $primary[ 'link-add.php' ] = array( _x( 'Link', 'add new from admin bar' ), 'new-link' ); 447 447 448 448 if ( current_user_can( 'create_users' ) || current_user_can( 'promote_users' ) ) 449 $secondary[ 'user-new.php' ] = array( _x( 'User', 'add new from admin bar' ), ' create_users', 'new-user' );449 $secondary[ 'user-new.php' ] = array( _x( 'User', 'add new from admin bar' ), 'new-user' ); 450 450 451 451 if ( ! is_multisite() && current_user_can( 'install_themes' ) ) 452 $secondary[ 'theme-install.php' ] = array( _x( 'Theme', 'add new from admin bar' ), ' install_themes', 'new-theme' );452 $secondary[ 'theme-install.php' ] = array( _x( 'Theme', 'add new from admin bar' ), 'new-theme' ); 453 453 454 454 if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) 455 $secondary[ 'plugin-install.php' ] = array( _x( 'Plugin', 'add new from admin bar' ), ' install_plugins', 'new-plugin' );456 457 if ( empty( $primary ) && empty( $secondary ))455 $secondary[ 'plugin-install.php' ] = array( _x( 'Plugin', 'add new from admin bar' ), 'new-plugin' ); 456 457 if ( ! $primary && ! $secondary ) 458 458 return; 459 459 … … 461 461 'id' => 'new-content', 462 462 'title' => _x( 'Add New', 'admin bar menu group label' ), 463 'href' => admin_url( array_shift( array_keys( $primary ) ) ),463 'href' => admin_url( current( array_keys( $primary ) ) ), 464 464 ) ); 465 465 … … 485 485 $wp_admin_bar->add_menu( array( 486 486 'parent' => $parent, 487 'id' => $action[ 2],487 'id' => $action[1], 488 488 'title' => $action[0], 489 489 'href' => admin_url( $link )
Note: See TracChangeset
for help on using the changeset viewer.