Make WordPress Core


Ignore:
Timestamp:
06/11/2011 02:20:18 AM (13 years ago)
Author:
nacin
Message:

Introduce name_admin_bar label and the show_in_admin_bar (Add New menu) argument for post types. Allows for proper translations of these strings and provides for consolidated logic. fixes #16406.

File:
1 edited

Legend:

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

    r18254 r18261  
    239239function wp_admin_bar_new_content_menu( $wp_admin_bar ) {
    240240    $actions = array();
    241     foreach ( (array) get_post_types( array( 'show_ui' => true ), 'objects' ) as $ptype_obj ) {
    242         if ( true !== $ptype_obj->show_in_menu || ! current_user_can( $ptype_obj->cap->edit_posts ) )
     241    foreach ( (array) get_post_types( array( 'show_in_admin_bar' => true ), 'objects' ) as $ptype_obj ) {
     242        if ( ! current_user_can( $ptype_obj->cap->edit_posts ) )
    243243            continue;
    244244
    245         $actions[ 'post-new.php?post_type=' . $ptype_obj->name ] = array( $ptype_obj->labels->singular_name, $ptype_obj->cap->edit_posts, 'new-' . $ptype_obj->name );
     245        $actions[ 'post-new.php?post_type=' . $ptype_obj->name ] = array( $ptype_obj->labels->name_admin_bar, $ptype_obj->cap->edit_posts, 'new-' . $ptype_obj->name );
    246246    }
    247247
Note: See TracChangeset for help on using the changeset viewer.