Change the ‘Howdy’ in WordPress admin bar

“Howdy, Mark Hall!” Oh please WordPress.

I changed it to ‘Hi, Mark Hall’ on the corporate web site, while looking through the functions.php for the IT Support Board, I decided to enhance it a little. What about a random selection?

[code]
/**
* Replace ‘Howdy’ with a random welcome message… because I can 😉
*/
function replace_howdy( $wp_admin_bar ) {
$my_account = $wp_admin_bar->get_node(‘my-account’);
$welcome_text = array(
‘Hi ‘, // So boring!
‘Well hellooooo there ‘, // too creepy
‘Ding dong! Hellooooo ‘, // Leslie Thomas
‘Another visitor, stay awhile. Stay FOREVER! ‘, // Impossible Mission
‘Howdy-doodly-do ‘, // Talkie Toaster
‘LTNS! HRU ‘, // chat room b*llocks
‘Uh oh, here’s trouble ‘, // no reason
‘Ah I’ve been expecting you ‘, // thanks Mark 🙂
‘Hello! is it me you’re looking for? ‘, // Lionel
‘You say goodbye, and I say Hello, hello hello ‘, // Hello goodbye
‘Sorry I can’t do that… Daisy, Daisy… ‘, // HAL
);
// could use array_rand(), but that would be too easy
$welcome_message = $welcome_text[mt_rand( 0, count($welcome_text) – 1 )];
$newtitle = str_replace( ‘Howdy,’, $welcome_message, $my_account->title );
$wp_admin_bar->add_node(
array(
‘id’ => ‘my-account’,
‘title’ => $newtitle,
)
);
}
add_filter( ‘admin_bar_menu’, ‘replace_howdy’,25 );
[/code]

Well that killed a couple minutes of working day 😉

Leave a Reply

Your email address will not be published. Required fields are marked *