PHP 更改WordPress 3.3管理栏中的Howdy文本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 更改WordPress 3.3管理栏中的Howdy文本相关的知识,希望对你有一定的参考价值。

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 ) {
/* 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',
'parent' => 'top-secondary',
'title' => $howdy . $avatar,
'href' => $profile_url,
'meta' => array(
'class' => $class,
),
) );

}
}

以上是关于PHP 更改WordPress 3.3管理栏中的Howdy文本的主要内容,如果未能解决你的问题,请参考以下文章

如何更改 wordpress 搜索栏中的搜索操作?

管理栏中的WordPress自定义链接

Wordpress - 更改 function.php 中的插件选项

替换WordPress管理栏中的“Howdy,admin”

WordPress功能“register_post_type”未显示在管理员左侧边栏中

php 更改Wordpress管理员登录页面