我想在登录后为用户显示,而不是默认单词 My Account 我想显示用户名,我尝试了此代码,但它没有显示任何内容!
它似乎无法识别$current_user
位于以下文件中的变量:wp-content/themes/themeName/framework/functions/woo-account.php
printf( __( '%s', 'wpdance' ),$current_user->user_lastname);
它是:
printf( __( 'My Account', 'wpdance' ));
我还尝试使用此代码获取所有内容:
<?php global $current_user;
get_currentuserinfo();
echo 'Username: ' . $current_user->user_login . "\n";
echo 'User email: ' . $current_user->user_email . "\n";
echo 'User level: ' . $current_user->user_level . "\n";
echo 'User first name: ' . $current_user->user_firstname . "\n";
echo 'User last name: ' . $current_user->user_lastname . "\n";
echo 'User display name: ' . $current_user->display_name . "\n";
echo 'User ID: ' . $current_user->ID . "\n";
?>
但又是空的User first name:
!User last name:
有人有什么建议或想法吗?
提前谢谢你!