Adding avatars/gravatar to a WordPress blog

You’re looking for the get_avatar function, documented here get_avatar( $id_or_email, $size, $default, $alt ) You’ll need either a user ID, or an email to use it, something like this should do the trick: echo get_avatar( get_comment_author_email(), ‘thumbnail’ ); If avatars are turned off in settings, this function will not return anything

Hexagon avatar with get_avatar()

You can use the extra_attr input argument to add extra arguments to the gravatar’s image tag: <?php echo get_avatar( ThemexUser::$data[‘user’][‘ID’], 200, // size ”, // default ”, // alt [ ‘extra_attr’ => ‘clip-path=”url(#myClip)”‘ ] // args ); ?> but note that it’s unescaped. You could also add e.g. class=”hexagon” with: <?php echo get_avatar( ThemexUser::$data[‘user’][‘ID’], 200, … Read more

How to change users avatar with specific e-mail addresses

Two things: The $id_or_email can be an integer (a user ID), a string (Gravatar MD5 hash or user email) or an object (e.g. a WP_User instance), so you can’t simply do $mail = $id_or_email->comment_author_email;. The email addresses in your list are all in the form of anonimus_<number>@anonimus.com, so instead of defining that long array, you … Read more

Gravatar – Default IMG

Your code actually works, it is just that you can’t do what you want. The way gravatar works is by serving the image if it has one and redirecting to the supplied default if it doesn’t, so even if the default is on your server you still can’t avoid the redirect. And gravatar really makes … Read more

How do I accesss gravatar?

The only place that gravatars are administered in WordPress core (without plugins, that is) is on the discussion settings page: If you want to access YOUR gravatar, go to http://gravatar.com and set up your profile. WordPress is set to automatically interface with gravatar using your user’s email address to identify you with gravatar.com.

show list of latest comments for each post in a loop

You should place your code inside the loop and add to the args array ‘post_id’ => get_the_ID() so it should look like this: while(have_posts()){ the_post(); //your post loop output $args = array( ‘status’ => ‘approved’, ‘number’ => ‘5’, ‘post_id’ => get_the_ID() ); $comments = get_comments($args); foreach($comments as $comment) : echo( $comment->get_avatar . $comment->comment_author . ‘<br … Read more

Which Function Displays The Post Authors Gravatar

Notice: get_the_author_ID is deprecated since version 2.8! Use get_the_author_meta(‘ID’) instead. in C:\Users\Administrator\Desktop\www.wpsites.dev\wp-includes\functions.php on line 2908 You aren’t using get_the_author_meta(‘ID’); as instructed by the Notice. You are just using get_the_author_meta(). The latter returns an empty string when I try it. Reference http://codex.wordpress.org/Function_Reference/get_the_author_meta