RAFI: My First WordPress Plugin

I just wrote and published my first WordPress plugin, Random Auto Featured Image, or RAFI for short.

Simply put, it adds a “featured image” to every post that doesn’t have one already set. Featured images are used to enhance post archive listings as well as blog listings in general.

When I first started using WordPress I didn’t specify a featured image, or thumbnail as they were originally called, when creating my posts.

That changed a few years back I started using the Avada theme. It makes great use of a post’s featured image.

So I started setting one when I made new posts.

To fix up the old posts I ran the Easy Add Thumbnail plugin. It looks for all posts lacking a featured image, but having images in the body of the post. It then sets the featured image to the first image.

That worked well enough, but left the first couple of years of blog entries, where my posts were more in the Dave Winer style: short snippets, lacking images, still lacking a featured image.

Now, with RAFI, even those posts have a featured image, albeit a random one from the blog’s library and only related to the post via coincidence.

This makes site archive pages more attractive as shown below, with the plugin applied on the left, and without the plugin on the right.

RAFI Adds a Featured Image to Posts
RAFI Adds a Featured Image to Posts

It’s available on the WordPress plugin site: RAFI