Toolbar: Polish design and code combining duplicate profile links.

Fixes some design changes and improves quality of comments and code styles following previous changes. Follow-up to [57708].

Props sabernhardt, huzaifaalmesbah, joedolson.
Fixes #43633. See #34668.
Built from https://develop.svn.wordpress.org/trunk@57765


git-svn-id: http://core.svn.wordpress.org/trunk@57266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
joedolson
2024-03-04 21:50:11 +00:00
parent 6e31cd8f9a
commit 1d4d8917f7
7 changed files with 16 additions and 22 deletions

View File

@@ -139,7 +139,7 @@ function wp_admin_bar_wp_menu( $wp_admin_bar ) {
__( 'About WordPress' ) .
'</span>',
'href' => $about_url,
'meta' => array(
'meta' => array(
'menu_title' => __( 'About WordPress' ),
),
);
@@ -286,7 +286,9 @@ function wp_admin_bar_my_account_item( $wp_admin_bar ) {
'href' => $profile_url,
'meta' => array(
'class' => $class,
/* translators: %s: Current user's display name. */
'menu_title' => sprintf( __( 'Howdy, %s' ), $current_user->display_name ),
'tabindex' => ( false !== $profile_url ) ? '' : 0,
),
)
);
@@ -329,7 +331,9 @@ function wp_admin_bar_my_account_menu( $wp_admin_bar ) {
$user_info .= "<span class='username'>{$current_user->user_login}</span>";
}
$user_info .= "<span class='edit-profile'>" . __( 'Edit Profile' ) . '</span>';
if ( false !== $profile_url ) {
$user_info .= "<span class='display-name edit-profile'>" . __( 'Edit Profile' ) . '</span>';
}
$wp_admin_bar->add_node(
array(
@@ -389,7 +393,7 @@ function wp_admin_bar_site_menu( $wp_admin_bar ) {
'id' => 'site-name',
'title' => $title,
'href' => ( is_admin() || ! current_user_can( 'read' ) ) ? home_url( '/' ) : admin_url(),
'meta' => array(
'meta' => array(
'menu_title' => $title,
),
)
@@ -990,7 +994,7 @@ function wp_admin_bar_new_content_menu( $wp_admin_bar ) {
'id' => 'new-content',
'title' => $title,
'href' => admin_url( current( array_keys( $actions ) ) ),
'meta' => array(
'meta' => array(
'menu_title' => _x( 'New', 'admin bar menu group label' ),
),
)