User rank in wordpress post

There is various approach you could take. All you need to do essentially is to get the author’s role and put it in a statement of sort.

For example, let’s get the author role first by:

// inside the loop
$author_role = get_the_author_meta('roles', $post->post_author);

Then just use do a if statement like:

if ($author_role == 'contributor') {
   echo '<img src="https://wordpress.stackexchange.com/questions/177751/contributor-ranked-user.png" />';
} else if ($author_role == 'author') {
// ...

Or to optimise it a bit, you could just target the filename if you can add the name of the role within it, something like this maybe:

  echo '<img src="'. $author_role .'-ranked-user.png" />';