Simple Local Avatar Plugin

I think that Im very close to achieve my goal.. I have this function on my themes but I need a help to find the right way to call simple local avatar function so it will show the local avatar image from simple local avatar pugin instead wordpress gravatar?

$first_img = get_avatar( $post-post_author );

Is there anyone can help?

function get_post_image() {
  global $post, $posts;
  $first_img = '';
  ob_start();
  ob_end_clean();
  $output = preg_match_all('/img.+src=[\'"]([^\'"]+)[\'"].*/i', $post-post_content, $matches);
  $first_img = $matches [1] [0];

  if(empty($first_img)){ //Defines a default image
    $first_img = get_avatar( $post-post_author );
  }
  return $first_img;
}

Topic gravatar avatar author images Wordpress

Category Web


The get_avatar function is pluggable, meaning that you can define a function of your own having that name and completely overwrite the default function.

If you look at the source for the "Simple Local Avatars" plugin, that is exactly what it has done. get_avatar in your code should be using the function defined by "Simple Local Avatars".

"Simple Local Avatars" provides a simplified function, get_simple_local_avatar, that you can use instead if you want.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.