开发者 | lawsonry |
---|---|
更新时间 | 2019年5月15日 04:55 |
PHP版本: | 3.0.1 及以上 |
WordPress版本: | 5.2 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
You forgot to save your profile after you uploaded the picture. Go back and reupload or reselect your author image and then once you click on the Make This My Author Profile Picture button, click on the blue Update Profile button at the bottom of your profile page.
Easy Author Image comes with a function that will return the url of the author's image. The function is called get_author_image_url().
If you want to display the author image in the loop, do something like this:
$avatar = get_author_image_url(); // The function uses get_the_ID() to grab the appropirate user ID for the author image. $name = get_the_author_meta('display_name'); $html = '<img src="$avatar" alt="A Picture of $name"/>'; echo $html;
If you want to display the author image somewhere not in the loop, do something like this:
$avatar = get_author_image_url('123'); // Replace 123 with the id of the author you want to use $name = get_the_author_meta('display_name'); $html = '<img src="$avatar" alt="A Picture of $name"/>'; echo $html;
Since Easy Author Image adds a new custom field to the user profile, you can also use WordPress's internal functionality to retrieve the author image url as well:
$url = get_the_author_meta('author_profile_picture', $user_id);
This plugin only deals with uploading and retrieving the image. It's up to you to format it appropriately to your theme.
Correct!
Nothing! Easy Author Image automagically defaults back to the Gravatar associated with the user's email address if no profile picture is uploaded.