+}
+
+/**
+ * Add the WordPress logo menu.
+ *
+ * @since 3.3.0
+ *
+ * @param WP_Admin_Bar $wp_admin_bar
+ */
+function wp_admin_bar_wp_menu( $wp_admin_bar ) {
+ $wp_admin_bar->add_menu( array(
+ 'id' => 'wp-logo',
+ 'title' => '<span class="ab-icon"></span><span class="screen-reader-text">' . __( 'About WordPress' ) . '</span>',
+ 'href' => self_admin_url( 'about.php' ),
+ ) );
+
+ if ( is_user_logged_in() ) {
+ // Add "About WordPress" link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wp-logo',
+ 'id' => 'about',
+ 'title' => __('About WordPress'),
+ 'href' => self_admin_url( 'about.php' ),
+ ) );
+ }
+
+ // Add WordPress.org link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wp-logo-external',
+ 'id' => 'wporg',
+ 'title' => __('WordPress.org'),
+ 'href' => __('https://wordpress.org/'),
+ ) );
+
+ // Add codex link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wp-logo-external',
+ 'id' => 'documentation',
+ 'title' => __('Documentation'),
+ 'href' => __('https://codex.wordpress.org/'),
+ ) );
+
+ // Add forums link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wp-logo-external',
+ 'id' => 'support-forums',
+ 'title' => __('Support Forums'),
+ 'href' => __('https://wordpress.org/support/'),
+ ) );
+
+ // Add feedback link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wp-logo-external',
+ 'id' => 'feedback',
+ 'title' => __('Feedback'),
+ 'href' => __('https://wordpress.org/support/forum/requests-and-feedback'),
+ ) );
+}
+
+/**
+ * Add the sidebar toggle button.
+ *
+ * @since 3.8.0
+ *
+ * @param WP_Admin_Bar $wp_admin_bar
+ */
+function wp_admin_bar_sidebar_toggle( $wp_admin_bar ) {
+ if ( is_admin() ) {
+ $wp_admin_bar->add_menu( array(
+ 'id' => 'menu-toggle',
+ 'title' => '<span class="ab-icon"></span><span class="screen-reader-text">' . __( 'Menu' ) . '</span>',
+ 'href' => '#',
+ ) );
+ }
+}
+
+/**
+ * Add the "My Account" item.
+ *
+ * @since 3.3.0
+ *
+ * @param WP_Admin_Bar $wp_admin_bar
+ */
+function wp_admin_bar_my_account_item( $wp_admin_bar ) {
+ $user_id = get_current_user_id();
+ $current_user = wp_get_current_user();
+
+ if ( ! $user_id )
+ return;
+
+ if ( current_user_can( 'read' ) ) {
+ $profile_url = get_edit_profile_url( $user_id );
+ } elseif ( is_multisite() ) {
+ $profile_url = get_dashboard_url( $user_id, 'profile.php' );
+ } else {
+ $profile_url = false;
+ }
+
+ $avatar = get_avatar( $user_id, 26 );
+ $howdy = sprintf( __('Howdy, %1$s'), $current_user->display_name );
+ $class = empty( $avatar ) ? '' : 'with-avatar';