plugins - Display post author avatar for Ultimate Member

admin2025-01-08  4

I want to show avatar from the post author. I use Ultimate Members and want to show the avatars that are defined via UM.

<?php
global $post;
$url = get_avatar_url( $post, array( 'size' => 48 ));
$img = '<img alt="" src="'. $url .'">';
echo $img;
?>

But this code shows the gravatars or default avatar. How can I get the avatars from Ultimate Member?

I want to show avatar from the post author. I use Ultimate Members and want to show the avatars that are defined via UM.

<?php
global $post;
$url = get_avatar_url( $post, array( 'size' => 48 ));
$img = '<img alt="" src="'. $url .'">';
echo $img;
?>

But this code shows the gravatars or default avatar. How can I get the avatars from Ultimate Member?

Share Improve this question asked Oct 12, 2018 at 11:33 Max MustermannMax Mustermann 11 silver badge4 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 0

To get user's avatars of the UM plugin, you have to do this :

// Returns a given user's avatar
um_get_user_avatar_url( $user_id = '', $size = '96' )

Moderator has delete this answer, but this code work:

get_avatar( get_the_author_meta( 'user_email' ), 48 );
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736270418a1427.html

最新回复(0)