Random Retro Avatar

01.15.2015

I was looking through the WordPress discussion settings and I discovered that you could set user avatars to be random if users did not have a gravatar.

I figured I could use the random avatar services for my purposes of adding random thumbnails for projects without thumbnails. Indeed it is easy with free services like wavatar and retro avatar. The code to do this is pretty simple.

In the WordPress theme file, just add an md5 hash of some property of the post to the name parameter in the query string in the API call. I chose the post title since it would be unique.

<img src="http://retroavatar.appspot.com/api?name=<?php echo md5($post->post_title) ?>"

Sources

http://retroavatar.appspot.com/