Alternate Recent Posts Widget

I’ve been fooling around with WordPress a lot lately, trying to get GeekLad.com configured just how I like it.  Most recently I added a Recent Posts widget.  The default Recent Posts widget displays links to all of your most recent posts.  If you are already displaying your most recent posts on the front page, the default Recent Posts widget can be rather repetitively redundant.  Unfortunately, I couldn’t find something out there that could quickly resolve the issue, so I resorted to writing a hack myself.

I directly edited the widgets.php file and added some extra code in the templates files as well, and I was finally able to achieve the desired result.  I wanted to share with the world what I had done, but what I had done wasn’t very practical.  If you were to ever change your theme or update to a new version of WordPress, the hack would need to be performed once again.  I decided I would take a stab at putting together a plugin to do it.

After perusing the WordPress Codex and reading a nice tutorial on creating WordPress widgets that Lonewolf put together, I finally managed to build a working plugin.  The options are exactly the same as the default Recent Posts Widget.  The only difference is that my widget will exclude any posts that appear within the main content of the current page.  Please let me know if you find any bugs with my plugin.  Being my first WordPress plugin, there may be some bugs that I wasn’t able to find.

Download the Plugin

Once you’ve downloaded, installed, and activated the plugin, go to the Design >> Widgets in the WordPress dashboard and add the Alternate Recent Posts widget and configure it as you please.  Below are a couple of screenshots that show what my page looked like before and after using my plugin:

Before
Before

After
After