Definition:
function wp_admin_bar_my_account_item( $wp_admin_bar ) {}
Add the "My Account" item.
Parameters
- $wp_admin_bar
Source code
function wp_admin_bar_my_account_item( $wp_admin_bar ) { $user_id = get_current_user_id(); $current_user = wp_get_current_user(); $profile_url = get_edit_profile_url( $user_id ); if ( ! $user_id ) return; $avatar = get_avatar( $user_id, 16 ); $howdy = sprintf( __('Howdy, %1$s'), $current_user->display_name ); $class = empty( $avatar ) ? '' : 'with-avatar'; $wp_admin_bar->add_menu( array( 'id' => 'my-account', 'parent' => 'top-secondary', 'title' => $howdy . $avatar, 'href' => $profile_url, 'meta' => array( 'class' => $class, 'title' => __('My Account'), ), ) ); }
17407
No comments yet... Be the first to leave a reply!