Monday, January 5, 2015

Replace Howdy with other any word in wordpress


Initially when we create a wordpress project and login then it show Howdy, [your login name]. If we want to replace any other word with this word how can we change it?
I know a solution and it is very easy/simple.

Generally it look like this image


We want to change howdy with hello like following image,

So, we want to write a simple function for this. You may add this function to your theme function.php file or create a plugin and write the following function on that plugin function file. The code is following -

function replace_howdy( $wp_admin_bar ) {
    $my_account=$wp_admin_bar->get_node('my-account');
    $newtitle = str_replace( 'Howdy,', 'Assalamualaikum', $my_account->title );
    $wp_admin_bar->add_node( array(
        'id' => 'my-account',
        'title' => $newtitle,
    ) );
}
add_filter( 'admin_bar_menu', 'replace_howdy',25 );

now it is the time for enjoy.

For any question on this topics please write comment.  

0 comments :

Post a Comment

 

Copyright @ 2014 Tech Tutorial .