Get the Official WPSaviour App Now!

BlogTutorials

How to Change the Howdy Text in WordPress 3.3 Admin Bar

Have you ever ever labored with a consumer the place you are attempting to customise the WordPress back-end expertise for them? Possibly you added a custom dashboard widget, removed menu items, and even created custom write panels. Properly Greg Kerstin (@graphicagenda) was engaged on a undertaking the place he needed to switch the howdy textual content within the WordPress admin bar. Usually it says Howdy, Username. He was type sufficient to submit a snippet to us wherein he reveals methods to change the howdy textual content and substitute it with Welcome.

All you must do is paste the next code in your theme’s features.php file, or create a website plugin.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
add_action( 'admin_bar_menu', 'wp_admin_bar_my_custom_account_menu', 11 );
perform 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 ) {
/* Add the "My Account" menu */
$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',
'dad or mum' => 'top-secondary',
'title' => $howdy . $avatar,
'href' => $profile_url,
'meta' => array(
'class' => $class,
),
) );
}
}

And you might be completed.

Download The WPSaviour App Now

Related posts
Beginner’s GuideBlogTutorials

Use Gutenberg like a pro with keyboard shortcuts

Beginner’s GuideBlogSecurityWordPress Security

A Simple Explanation of SSL Certificate Errors & How to Fix Them

Beginner’s GuideBest WordPress PluginsBlog

9 Best A/B Split Testing Plugins for WordPress

Best WordPress PluginsBlog

7 Best Plugins for Tracking User Activity in WordPress

Sign up for our Newsletter and
stay informed

Leave a Reply

Your email address will not be published.

Fear Of Missing Out?

Sign up with your email address to receive WordPress tips and updates
SUBSCRIBE NOW
Terms and Conditions apply
close-link
Click Me