Toolbar: Use `add_node()` instead of `add_menu()` in core.
This patch replaces all references to the add_menu() method with the add_node() one. (Also some code structure modifications for wp_admin_bar_appearance_menu().) Fixes: #19647 Props: linuxologos, paulschreiber, morganestes, akibjorklund, nacin, whyisjake. Built from https://develop.svn.wordpress.org/trunk@46642 git-svn-id: http://core.svn.wordpress.org/trunk@46442 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
946217dcca
commit
5e7876622e
|
@ -131,11 +131,11 @@ function wp_admin_bar_wp_menu( $wp_admin_bar ) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$wp_admin_bar->add_menu( $wp_logo_menu_args );
|
$wp_admin_bar->add_node( $wp_logo_menu_args );
|
||||||
|
|
||||||
if ( $about_url ) {
|
if ( $about_url ) {
|
||||||
// Add "About WordPress" link
|
// Add "About WordPress" link
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'wp-logo',
|
'parent' => 'wp-logo',
|
||||||
'id' => 'about',
|
'id' => 'about',
|
||||||
|
@ -146,7 +146,7 @@ function wp_admin_bar_wp_menu( $wp_admin_bar ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add WordPress.org link
|
// Add WordPress.org link
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'wp-logo-external',
|
'parent' => 'wp-logo-external',
|
||||||
'id' => 'wporg',
|
'id' => 'wporg',
|
||||||
|
@ -156,7 +156,7 @@ function wp_admin_bar_wp_menu( $wp_admin_bar ) {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add codex link
|
// Add codex link
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'wp-logo-external',
|
'parent' => 'wp-logo-external',
|
||||||
'id' => 'documentation',
|
'id' => 'documentation',
|
||||||
|
@ -166,7 +166,7 @@ function wp_admin_bar_wp_menu( $wp_admin_bar ) {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add forums link
|
// Add forums link
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'wp-logo-external',
|
'parent' => 'wp-logo-external',
|
||||||
'id' => 'support-forums',
|
'id' => 'support-forums',
|
||||||
|
@ -176,7 +176,7 @@ function wp_admin_bar_wp_menu( $wp_admin_bar ) {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add feedback link
|
// Add feedback link
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'wp-logo-external',
|
'parent' => 'wp-logo-external',
|
||||||
'id' => 'feedback',
|
'id' => 'feedback',
|
||||||
|
@ -195,7 +195,7 @@ function wp_admin_bar_wp_menu( $wp_admin_bar ) {
|
||||||
*/
|
*/
|
||||||
function wp_admin_bar_sidebar_toggle( $wp_admin_bar ) {
|
function wp_admin_bar_sidebar_toggle( $wp_admin_bar ) {
|
||||||
if ( is_admin() ) {
|
if ( is_admin() ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'id' => 'menu-toggle',
|
'id' => 'menu-toggle',
|
||||||
'title' => '<span class="ab-icon"></span><span class="screen-reader-text">' . __( 'Menu' ) . '</span>',
|
'title' => '<span class="ab-icon"></span><span class="screen-reader-text">' . __( 'Menu' ) . '</span>',
|
||||||
|
@ -233,7 +233,7 @@ function wp_admin_bar_my_account_item( $wp_admin_bar ) {
|
||||||
$howdy = sprintf( __( 'Howdy, %s' ), '<span class="display-name">' . $current_user->display_name . '</span>' );
|
$howdy = sprintf( __( 'Howdy, %s' ), '<span class="display-name">' . $current_user->display_name . '</span>' );
|
||||||
$class = empty( $avatar ) ? '' : 'with-avatar';
|
$class = empty( $avatar ) ? '' : 'with-avatar';
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'id' => 'my-account',
|
'id' => 'my-account',
|
||||||
'parent' => 'top-secondary',
|
'parent' => 'top-secondary',
|
||||||
|
@ -283,7 +283,7 @@ function wp_admin_bar_my_account_menu( $wp_admin_bar ) {
|
||||||
$user_info .= "<span class='username'>{$current_user->user_login}</span>";
|
$user_info .= "<span class='username'>{$current_user->user_login}</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'user-actions',
|
'parent' => 'user-actions',
|
||||||
'id' => 'user-info',
|
'id' => 'user-info',
|
||||||
|
@ -296,7 +296,7 @@ function wp_admin_bar_my_account_menu( $wp_admin_bar ) {
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( false !== $profile_url ) {
|
if ( false !== $profile_url ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'user-actions',
|
'parent' => 'user-actions',
|
||||||
'id' => 'edit-profile',
|
'id' => 'edit-profile',
|
||||||
|
@ -306,7 +306,7 @@ function wp_admin_bar_my_account_menu( $wp_admin_bar ) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'user-actions',
|
'parent' => 'user-actions',
|
||||||
'id' => 'logout',
|
'id' => 'logout',
|
||||||
|
@ -350,7 +350,7 @@ function wp_admin_bar_site_menu( $wp_admin_bar ) {
|
||||||
|
|
||||||
$title = wp_html_excerpt( $blogname, 40, '…' );
|
$title = wp_html_excerpt( $blogname, 40, '…' );
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'id' => 'site-name',
|
'id' => 'site-name',
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
@ -362,7 +362,7 @@ function wp_admin_bar_site_menu( $wp_admin_bar ) {
|
||||||
|
|
||||||
if ( is_admin() ) {
|
if ( is_admin() ) {
|
||||||
// Add an option to visit the site.
|
// Add an option to visit the site.
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'site-name',
|
'parent' => 'site-name',
|
||||||
'id' => 'view-site',
|
'id' => 'view-site',
|
||||||
|
@ -372,7 +372,7 @@ function wp_admin_bar_site_menu( $wp_admin_bar ) {
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( is_blog_admin() && is_multisite() && current_user_can( 'manage_sites' ) ) {
|
if ( is_blog_admin() && is_multisite() && current_user_can( 'manage_sites' ) ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'site-name',
|
'parent' => 'site-name',
|
||||||
'id' => 'edit-site',
|
'id' => 'edit-site',
|
||||||
|
@ -383,7 +383,7 @@ function wp_admin_bar_site_menu( $wp_admin_bar ) {
|
||||||
}
|
}
|
||||||
} elseif ( current_user_can( 'read' ) ) {
|
} elseif ( current_user_can( 'read' ) ) {
|
||||||
// We're on the front end, link to the Dashboard.
|
// We're on the front end, link to the Dashboard.
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'site-name',
|
'parent' => 'site-name',
|
||||||
'id' => 'dashboard',
|
'id' => 'dashboard',
|
||||||
|
@ -428,7 +428,7 @@ function wp_admin_bar_customize_menu( $wp_admin_bar ) {
|
||||||
$customize_url = add_query_arg( array( 'changeset_uuid' => $wp_customize->changeset_uuid() ), $customize_url );
|
$customize_url = add_query_arg( array( 'changeset_uuid' => $wp_customize->changeset_uuid() ), $customize_url );
|
||||||
}
|
}
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'id' => 'customize',
|
'id' => 'customize',
|
||||||
'title' => __( 'Customize' ),
|
'title' => __( 'Customize' ),
|
||||||
|
@ -465,7 +465,7 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
||||||
$my_sites_url = admin_url( 'my-sites.php' );
|
$my_sites_url = admin_url( 'my-sites.php' );
|
||||||
}
|
}
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'id' => 'my-sites',
|
'id' => 'my-sites',
|
||||||
'title' => __( 'My Sites' ),
|
'title' => __( 'My Sites' ),
|
||||||
|
@ -481,7 +481,7 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'my-sites-super-admin',
|
'parent' => 'my-sites-super-admin',
|
||||||
'id' => 'network-admin',
|
'id' => 'network-admin',
|
||||||
|
@ -490,7 +490,7 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'network-admin',
|
'parent' => 'network-admin',
|
||||||
'id' => 'network-admin-d',
|
'id' => 'network-admin-d',
|
||||||
|
@ -500,7 +500,7 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( current_user_can( 'manage_sites' ) ) {
|
if ( current_user_can( 'manage_sites' ) ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'network-admin',
|
'parent' => 'network-admin',
|
||||||
'id' => 'network-admin-s',
|
'id' => 'network-admin-s',
|
||||||
|
@ -511,7 +511,7 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current_user_can( 'manage_network_users' ) ) {
|
if ( current_user_can( 'manage_network_users' ) ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'network-admin',
|
'parent' => 'network-admin',
|
||||||
'id' => 'network-admin-u',
|
'id' => 'network-admin-u',
|
||||||
|
@ -522,7 +522,7 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current_user_can( 'manage_network_themes' ) ) {
|
if ( current_user_can( 'manage_network_themes' ) ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'network-admin',
|
'parent' => 'network-admin',
|
||||||
'id' => 'network-admin-t',
|
'id' => 'network-admin-t',
|
||||||
|
@ -533,7 +533,7 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current_user_can( 'manage_network_plugins' ) ) {
|
if ( current_user_can( 'manage_network_plugins' ) ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'network-admin',
|
'parent' => 'network-admin',
|
||||||
'id' => 'network-admin-p',
|
'id' => 'network-admin-p',
|
||||||
|
@ -544,7 +544,7 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current_user_can( 'manage_network_options' ) ) {
|
if ( current_user_can( 'manage_network_options' ) ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'network-admin',
|
'parent' => 'network-admin',
|
||||||
'id' => 'network-admin-o',
|
'id' => 'network-admin-o',
|
||||||
|
@ -580,7 +580,7 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
||||||
$menu_id = 'blog-' . $blog->userblog_id;
|
$menu_id = 'blog-' . $blog->userblog_id;
|
||||||
|
|
||||||
if ( current_user_can( 'read' ) ) {
|
if ( current_user_can( 'read' ) ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'my-sites-list',
|
'parent' => 'my-sites-list',
|
||||||
'id' => $menu_id,
|
'id' => $menu_id,
|
||||||
|
@ -589,7 +589,7 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => $menu_id,
|
'parent' => $menu_id,
|
||||||
'id' => $menu_id . '-d',
|
'id' => $menu_id . '-d',
|
||||||
|
@ -598,7 +598,7 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'my-sites-list',
|
'parent' => 'my-sites-list',
|
||||||
'id' => $menu_id,
|
'id' => $menu_id,
|
||||||
|
@ -609,7 +609,7 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
|
if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => $menu_id,
|
'parent' => $menu_id,
|
||||||
'id' => $menu_id . '-n',
|
'id' => $menu_id . '-n',
|
||||||
|
@ -620,7 +620,7 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current_user_can( 'edit_posts' ) ) {
|
if ( current_user_can( 'edit_posts' ) ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => $menu_id,
|
'parent' => $menu_id,
|
||||||
'id' => $menu_id . '-c',
|
'id' => $menu_id . '-c',
|
||||||
|
@ -630,7 +630,7 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => $menu_id,
|
'parent' => $menu_id,
|
||||||
'id' => $menu_id . '-v',
|
'id' => $menu_id . '-v',
|
||||||
|
@ -660,7 +660,7 @@ function wp_admin_bar_shortlink_menu( $wp_admin_bar ) {
|
||||||
|
|
||||||
$html = '<input class="shortlink-input" type="text" readonly="readonly" value="' . esc_attr( $short ) . '" />';
|
$html = '<input class="shortlink-input" type="text" readonly="readonly" value="' . esc_attr( $short ) . '" />';
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'title' => __( 'Shortlink' ),
|
'title' => __( 'Shortlink' ),
|
||||||
|
@ -702,7 +702,7 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
|
||||||
&& ( $post_type_object->show_in_admin_bar ) ) {
|
&& ( $post_type_object->show_in_admin_bar ) ) {
|
||||||
if ( 'draft' == $post->post_status ) {
|
if ( 'draft' == $post->post_status ) {
|
||||||
$preview_link = get_preview_post_link( $post );
|
$preview_link = get_preview_post_link( $post );
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'id' => 'preview',
|
'id' => 'preview',
|
||||||
'title' => $post_type_object->labels->view_item,
|
'title' => $post_type_object->labels->view_item,
|
||||||
|
@ -711,7 +711,7 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'id' => 'view',
|
'id' => 'view',
|
||||||
'title' => $post_type_object->labels->view_item,
|
'title' => $post_type_object->labels->view_item,
|
||||||
|
@ -735,7 +735,7 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
|
||||||
} elseif ( 'term' == $current_screen->base && isset( $tag ) && is_object( $tag ) && ! is_wp_error( $tag ) ) {
|
} elseif ( 'term' == $current_screen->base && isset( $tag ) && is_object( $tag ) && ! is_wp_error( $tag ) ) {
|
||||||
$tax = get_taxonomy( $tag->taxonomy );
|
$tax = get_taxonomy( $tag->taxonomy );
|
||||||
if ( is_taxonomy_viewable( $tax ) ) {
|
if ( is_taxonomy_viewable( $tax ) ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'id' => 'view',
|
'id' => 'view',
|
||||||
'title' => $tax->labels->view_item,
|
'title' => $tax->labels->view_item,
|
||||||
|
@ -747,7 +747,7 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
|
||||||
$user_object = get_userdata( $user_id );
|
$user_object = get_userdata( $user_id );
|
||||||
$view_link = get_author_posts_url( $user_object->ID );
|
$view_link = get_author_posts_url( $user_object->ID );
|
||||||
if ( $user_object->exists() && $view_link ) {
|
if ( $user_object->exists() && $view_link ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'id' => 'view',
|
'id' => 'view',
|
||||||
'title' => __( 'View User' ),
|
'title' => __( 'View User' ),
|
||||||
|
@ -770,7 +770,7 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
|
||||||
&& $edit_post_link
|
&& $edit_post_link
|
||||||
&& current_user_can( 'edit_post', $current_object->ID )
|
&& current_user_can( 'edit_post', $current_object->ID )
|
||||||
&& $post_type_object->show_in_admin_bar ) {
|
&& $post_type_object->show_in_admin_bar ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'id' => 'edit',
|
'id' => 'edit',
|
||||||
'title' => $post_type_object->labels->edit_item,
|
'title' => $post_type_object->labels->edit_item,
|
||||||
|
@ -782,7 +782,7 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
|
||||||
$tax = get_taxonomy( $current_object->taxonomy );
|
$tax = get_taxonomy( $current_object->taxonomy );
|
||||||
$edit_term_link = get_edit_term_link( $current_object->term_id, $current_object->taxonomy );
|
$edit_term_link = get_edit_term_link( $current_object->term_id, $current_object->taxonomy );
|
||||||
if ( $tax && $edit_term_link && current_user_can( 'edit_term', $current_object->term_id ) ) {
|
if ( $tax && $edit_term_link && current_user_can( 'edit_term', $current_object->term_id ) ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'id' => 'edit',
|
'id' => 'edit',
|
||||||
'title' => $tax->labels->edit_item,
|
'title' => $tax->labels->edit_item,
|
||||||
|
@ -793,7 +793,7 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
|
||||||
} elseif ( is_a( $current_object, 'WP_User' ) && current_user_can( 'edit_user', $current_object->ID ) ) {
|
} elseif ( is_a( $current_object, 'WP_User' ) && current_user_can( 'edit_user', $current_object->ID ) ) {
|
||||||
$edit_user_link = get_edit_user_link( $current_object->ID );
|
$edit_user_link = get_edit_user_link( $current_object->ID );
|
||||||
if ( $edit_user_link ) {
|
if ( $edit_user_link ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'id' => 'edit',
|
'id' => 'edit',
|
||||||
'title' => __( 'Edit User' ),
|
'title' => __( 'Edit User' ),
|
||||||
|
@ -859,7 +859,7 @@ function wp_admin_bar_new_content_menu( $wp_admin_bar ) {
|
||||||
|
|
||||||
$title = '<span class="ab-icon"></span><span class="ab-label">' . _x( 'New', 'admin bar menu group label' ) . '</span>';
|
$title = '<span class="ab-icon"></span><span class="ab-label">' . _x( 'New', 'admin bar menu group label' ) . '</span>';
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'id' => 'new-content',
|
'id' => 'new-content',
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
@ -870,7 +870,7 @@ function wp_admin_bar_new_content_menu( $wp_admin_bar ) {
|
||||||
foreach ( $actions as $link => $action ) {
|
foreach ( $actions as $link => $action ) {
|
||||||
list( $title, $id ) = $action;
|
list( $title, $id ) = $action;
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'new-content',
|
'parent' => 'new-content',
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
|
@ -905,7 +905,7 @@ function wp_admin_bar_comments_menu( $wp_admin_bar ) {
|
||||||
$title = '<span class="ab-label awaiting-mod pending-count count-' . $awaiting_mod . '" aria-hidden="true">' . number_format_i18n( $awaiting_mod ) . '</span>';
|
$title = '<span class="ab-label awaiting-mod pending-count count-' . $awaiting_mod . '" aria-hidden="true">' . number_format_i18n( $awaiting_mod ) . '</span>';
|
||||||
$title .= '<span class="screen-reader-text comments-in-moderation-text">' . $awaiting_text . '</span>';
|
$title .= '<span class="screen-reader-text comments-in-moderation-text">' . $awaiting_text . '</span>';
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'id' => 'comments',
|
'id' => 'comments',
|
||||||
'title' => $icon . $title,
|
'title' => $icon . $title,
|
||||||
|
@ -930,7 +930,7 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( current_user_can( 'switch_themes' ) ) {
|
if ( current_user_can( 'switch_themes' ) ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'appearance',
|
'parent' => 'appearance',
|
||||||
'id' => 'themes',
|
'id' => 'themes',
|
||||||
|
@ -945,7 +945,7 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current_theme_supports( 'widgets' ) ) {
|
if ( current_theme_supports( 'widgets' ) ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'appearance',
|
'parent' => 'appearance',
|
||||||
'id' => 'widgets',
|
'id' => 'widgets',
|
||||||
|
@ -956,7 +956,7 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) {
|
if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'appearance',
|
'parent' => 'appearance',
|
||||||
'id' => 'menus',
|
'id' => 'menus',
|
||||||
|
@ -967,7 +967,7 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current_theme_supports( 'custom-background' ) ) {
|
if ( current_theme_supports( 'custom-background' ) ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'appearance',
|
'parent' => 'appearance',
|
||||||
'id' => 'background',
|
'id' => 'background',
|
||||||
|
@ -981,7 +981,7 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( current_theme_supports( 'custom-header' ) ) {
|
if ( current_theme_supports( 'custom-header' ) ) {
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'appearance',
|
'parent' => 'appearance',
|
||||||
'id' => 'header',
|
'id' => 'header',
|
||||||
|
@ -1014,7 +1014,7 @@ function wp_admin_bar_updates_menu( $wp_admin_bar ) {
|
||||||
$title = '<span class="ab-icon"></span><span class="ab-label">' . number_format_i18n( $update_data['counts']['total'] ) . '</span>';
|
$title = '<span class="ab-icon"></span><span class="ab-label">' . number_format_i18n( $update_data['counts']['total'] ) . '</span>';
|
||||||
$title .= '<span class="screen-reader-text">' . $update_data['title'] . '</span>';
|
$title .= '<span class="screen-reader-text">' . $update_data['title'] . '</span>';
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'id' => 'updates',
|
'id' => 'updates',
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
@ -1044,7 +1044,7 @@ function wp_admin_bar_search_menu( $wp_admin_bar ) {
|
||||||
$form .= '<input type="submit" class="adminbar-button" value="' . __( 'Search' ) . '"/>';
|
$form .= '<input type="submit" class="adminbar-button" value="' . __( 'Search' ) . '"/>';
|
||||||
$form .= '</form>';
|
$form .= '</form>';
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'top-secondary',
|
'parent' => 'top-secondary',
|
||||||
'id' => 'search',
|
'id' => 'search',
|
||||||
|
@ -1073,7 +1073,7 @@ function wp_admin_bar_recovery_mode_menu( $wp_admin_bar ) {
|
||||||
$url = add_query_arg( 'action', WP_Recovery_Mode::EXIT_ACTION, $url );
|
$url = add_query_arg( 'action', WP_Recovery_Mode::EXIT_ACTION, $url );
|
||||||
$url = wp_nonce_url( $url, WP_Recovery_Mode::EXIT_ACTION );
|
$url = wp_nonce_url( $url, WP_Recovery_Mode::EXIT_ACTION );
|
||||||
|
|
||||||
$wp_admin_bar->add_menu(
|
$wp_admin_bar->add_node(
|
||||||
array(
|
array(
|
||||||
'parent' => 'top-secondary',
|
'parent' => 'top-secondary',
|
||||||
'id' => 'recovery-mode',
|
'id' => 'recovery-mode',
|
||||||
|
|
|
@ -82,16 +82,28 @@ class WP_Admin_Bar {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $node
|
* Add a node (menu item) to the Admin Bar menu.
|
||||||
|
*
|
||||||
|
* @since 3.3.0
|
||||||
|
* @since 5.4.0 Deprecated in favor of {@see WP_Admin_Bar::add_node()}.
|
||||||
|
*
|
||||||
|
* @param array $node The attributes that define the node.
|
||||||
*/
|
*/
|
||||||
public function add_menu( $node ) {
|
public function add_menu( $node ) {
|
||||||
|
_deprecated_function( __METHOD__, '5.4.0', __CLASS__ . '::add_node()' );
|
||||||
$this->add_node( $node );
|
$this->add_node( $node );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $id
|
* Remove a node from the admin bar.
|
||||||
|
*
|
||||||
|
* @since 3.1.0
|
||||||
|
* @since 5.4.0 Deprecated in favor of {@see WP_Admin_Bar::remove_node()}.
|
||||||
|
*
|
||||||
|
* @param string $id The menu slug to remove.
|
||||||
*/
|
*/
|
||||||
public function remove_menu( $id ) {
|
public function remove_menu( $id ) {
|
||||||
|
_deprecated_function( __METHOD__, '5.4.0', __CLASS__ . '::remove_node()' );
|
||||||
$this->remove_node( $id );
|
$this->remove_node( $id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.4-alpha-46641';
|
$wp_version = '5.4-alpha-46642';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue