How to load locally saved author photos based on author ID

One option is to use the pre_get_avatar filter to return custom avatar HTML, which will short-circuit get_avatar() preventing it from reaching out to Gravatar for the image. For example like this, add_filter(‘pre_get_avatar’, ‘wpse_410434_author_img_html’, 10, 3); function wpse_410434_author_img_html( $avatar, $id_or_email, $args ) { if ( $avatar || ! is_numeric( $id_or_email ) ) { return $avatar; } … Read more

Building Gravatar Code

If you look at the Gravatar API you will see that you can call a user specific and specify a default so here a built proof way to get the the image url in your code. $email = $comment->comment_author_email; $size = 60; $rating = get_option(‘avatar_rating’); $default = urlencode( ‘http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=” . $size ); $grav_url = “http://www.gravatar.com/avatar/’. … Read more

Adding Gravatar to rss feed

The point is, that the format have no tags for a image to a user. You must use a other tag to inlcude the avatar of a author, not the author tag. The author tag is only for a string, not markkup or images. But you can add content ot the desciption and this is … Read more

Show author name not the author ID

<?php $product_pages_args = array( ‘meta_key’ => ‘_wp_page_template’, ‘meta_value’ => ‘page_library_html_content.php’, ‘hierarchical’ => ‘0’ ); $product_pages = get_pages( $product_pages_args ); ?> <?php foreach ( $product_pages as $product_page ) { $author_id = get_post_field(‘post_author’, $product_page->ID ); $author_details = get_user_by( ‘id’, $author_id ); $author_name = $author_details->first_name . ‘ ‘ . $author_details->last_name; echo ‘<div id=”posts” class=”flex_100″>’; echo ‘<div id=”library_title”><a href=”‘ … Read more