Skip to content

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

32 thoughts on “Alternate Recent Posts Widget”

  1. Hey I just want to say this is a sweet plugin – I've always hated the redundancy of the recent posts lists on my sites. Just started using this plugin today and now I wonder why WordPress doesn't do this outta the box, it makes so much sense. Thanks!

  2. Pingback: Alternate Recent Posts: A clever, simple & useful Wordpress plugin: « Web Guy 303

  3. Pingback: Alternate Recent Posts Widget Not Working along with Widget Logic Plugin Conditional Tag

  4. Pingback: Rearranging the Dust « Little Storping-in-the-Swuff

  5. Pingback: Best Wordpress Plug-Ins | Services For Seo

  6. I love this plugin – but since updating to WP3.1 it now shows the same posts as the 'normal' recent posts widget. Will you be making a fix?

    Thank you.

    1. It's been a while since I've done any WordPress development, so probably not

      any time soon. Something must have changed in the API that broke my code.

      🙁 I don't know why they don't change the main code for that widget to

      exclude the post(s) currently displayed on the screen. It really doesn't

      make sense to have that duplication as the default behavior.

  7. Pingback: Read the latest news around the world today! Including the Norway bombing and more! « tokyoartpaf.com

  8. Pingback: Read the latest news around the world today! Including the Norway bombing and more! | i1 Review

  9. Looking at other guidelines on how to create your home? Most properties – over 90% – according to a newest NAHB (National Relationships of House Builders) are keep developed – relevance out of 2 x 4’s.Bumper Sticker

  10. I must express my admiration for your generosity in support of men and women who should have assistance with your concern. Your very own dedication to getting the message across appears to be quite useful and has constantly empowered individuals just like me to reach their ambitions. Your amazing invaluable report indicates a great deal to me and somewhat more to my colleagues. Thank you; from everyone of us.
    loft insulation boards

  11. I am using the default recent comments widget on my blog and I believe it gets updated itself. So, I never thought of using any other widget in its place. But I am not happy with the recent comments widget, can you suggest me any?

  12. I wanted to create you a bit of observation to help thank you very much the moment again for all the superb ideas you have discussed on this site. It is certainly surprisingly generous of you to provide easily what a lot of folks could possibly have offered for sale for an e-book to help make some dough for themselves, primarily considering that you might have done it if you decided. Those concepts as well worked as a fantastic way to be certain that some people have similar fervor the same as my own to see a lot more in terms of this condition. I am certain there are many more enjoyable occasions ahead for folks who check out your blog.
    Teas For Weight Loss

Leave a Reply

Your email address will not be published. Required fields are marked *