Word Press

change the howdy Text in wordpress

Copy and paste Below code in your function.php file

add_action( 'admin_bar_menu', 'wp_admin_bar_my_custom_account_menu', 11 );

function wp_admin_bar_my_custom_account_menu( $wp_admin_bar )
{
      $user_id = get_current_user_id();
      $current_user = wp_get_current_user();
      $profile_url = get_edit_profile_url( $user_id );
      if ( 0 != $user_id )
      {

            $avatar = get_avatar( $user_id, 28 );
            $howdy = sprintf( __('Welcome, %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)
                                           ) );

      }
}
Advertisements

Leave your comments

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s