A Quick WordPress Plugin: There Can Be Only One

It’s been over seven years since I last built or maintained a WordPress plugin, thanks in large part to the great community of WordPress plugin developers who share their hard work for the community as a whole. Yet, I finally ran into a situation that wasn’t handled by an available plugin. I patched this in my custom functions.php file with some help from code that I found here (thanks Craige!) and have cruised along for a good while, but I wanted to strengthen my solution while giving back to the WordPress community.

(TLDR – the WordPress community is awesome, and I published this plugin: There Can Be Only One)

My Goal

There should always be one (and only one!) sticky post visible at the top of my home page.

The Setup

I post many links and images on my site, which means the majority of my front page is made up of links elsewhere, and anything that I write is quickly lost in the stream. Sticky posts help to address this, allowing me to designate that a post should be shown at the top of my home page, regardless of whether it is the newest or not. Awesome!
[Read more…]