Setting different width and height for gravatar
Unfortunately at moment Gravatar service itself only accepts single number for size and only serves square images. So you have to achieve it with CSS or download, modify and cache images.
Unfortunately at moment Gravatar service itself only accepts single number for size and only serves square images. So you have to achieve it with CSS or download, modify and cache images.
I had a look at the avatar related functions/filters WP provides and I don’t think there is a direct way to tell, if the avatar is a real one or the default image as you only have url to work with. But, I also looked at the Gravatar implementation guide, https://en.gravatar.com/site/implement/images/, which notes that you … Read more
If you are looking to connect your sites sign-up with Gravatar then you simply can’t, since Gravatar don’t have a sing-up api you can use. But if you are just looking to let your users upload there own photos the either Simple Local Avatars Plugin that Chip suggested or one I’ve used a lot before … Read more
Sergey, use this in place where you are going to put form to edit avatar: <?php $myAv = new simple_local_avatars(); $myAv->edit_user_profile($profileuser); ?>
The function that does all the heavy lifting for avatars is get_avatar. It’s a pluggable function, meaning you can replace it with a plugin. Get avatar also has a handy filter you can use to override things programatically. So, a few options: (1) completely replace get_avatar which might have unintended side effects and break things … Read more
The Original Poster was missing the pair priority, parameters when declaring the filter hook: add_filter( ‘get_avatar’, array( $this, ‘get_avatar’ ), 10, 5 ); Being 5 all the parameters the callback function can use: public function get_avatar( $avatar, $id_or_email, $size, $default, $alt ) { return $avatar; }
I had this problem, too. Here’s the solution for version 4.7.3 if anyone comes across this. get_avatar( $id_or_email = get_the_author_meta( ‘user_email’ ), $size=”60″, $default, $alt, $args = array( ‘class’ => array( ‘d-block’, ‘mx-auto’ ) ) ); or shorter version get_avatar( get_the_author_meta( ‘user_email’ ), ’60’, $default, $alt, array( ‘class’ => array( ‘d-block’, ‘mx-auto’ ) ) ); … Read more
As an alternative to my other answer, you can also use the get_avatar filter. Props to Sumit to alerting me to this one. The benefit of using the get_avatar filter is your custom avatar should be applied anywhere WordPress uses it, rather than just in this users list like my other answer deals with. If … Read more
I am not sure why your query is returning more IDs than necessary. The $args for get_users look correct. By default get_users does not support orderby=rand, but you can overwrite that option. See below: function random_user_query( &$query ) { $query->query_orderby = “ORDER BY RAND()”; } // Usage: [random_users how_many = 3] add_shortcode( ‘random_users’, ‘display_random_users’ ); … Read more
There are two ways to customize the default avatar: Add a new default avatar to Settings/Discussion. Change the output of get_avatar(). Let’s start with the first option; this processes slightly faster. Add a new default avatar to Settings/Discussion There is a filter ‘avatar_defaults’. You can add more avatars here. You get an array of default … Read more