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

About GeekLad

Geeklad is a technology enthusiast and programming hobbyist. Occasionally he will put together useful little bits of code (be it JavaScript or PHP) and share them with the world. He also enjoys creating and sharing howtos, describing how to do the things people want to do with their computers.
Tagged , . Bookmark the permalink.
  • http://blog.turkbaron.com baron

    hi. Thanks for plugin

    perfect.

    Regards

  • buddhakwee

    get backlink for my site hi-rank

  • http://www.valleychai.com/ spandana

    didn't work.. still showed the same posts., running wordpress 2.8. thanks for the code, though., this is a typical problem with blog recent posts.

  • http://geeklad.com GeekLad

    That's odd… I haven't updated to 2.8 yet, so I'll have to see what's
    going on there. Thanks for letting me know about the problem.

  • http://webguy303.com/ Web Guy 303

    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!

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

  • http://webguy303.com/ Web Guy 303

    Hey just a heads up, I ran into a small issue with the code – I described it and posted a fix here: http://webguy303.com/2009/06/alternate-recent-p

  • http://geeklad.com GeekLad

    Thanks for the fix. I didn't realize I was leaving open tags. I'll update
    the plugin to include your fix.

  • http://www.vistodallalto.com/blog Sciabb

    Is it possible to display this plug-in in the footer instead of the sidebar??

  • http://geeklad.com GeekLad

    Not at this time. It is really meant to replace the existing recent posts
    widget and nothing more.

  • http://www.engadgeteer.com/ engadgeteer

    I have find a quick and easy to install and customize Recent Post Widget with thumbnails. You can install it in minute with hassle-free complicated manual code installation.

    You may look at this link for more information : http://www.engadgeteer.com/2009/07/recent-posts

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

  • dontcry

    I have find a quick and easy to install and customize Recent Post Widget with thumbnails. You can install it in minute with hassle-free complicated manual code installation. club penguin cheats

  • lubomir

    i was looking for this :) thank you

  • Pingback: Rearranging the Dust « Little Storping-in-the-Swuff

  • Pingback: Best Wordpress Plug-Ins | Services For Seo

  • http://pulse.yahoo.com/_X7KRGJ5XC3FG3FJKMH2PS3M2HM Sylvia Wilkins

    I had a few problems with this with 2.8 WP but after the update it's running great. I think the plugin is a great visual enhancement to pages. Me likes!

    -Sylvia
    Need beautiful Antique Jewelry?

  • griff701

    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.

  • http://geeklad.com GeekLad

    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.

  • webhos

    I have seen this recent posts on many blogs lately and I was wondering how this was possible. I thought it was because of a addon or widget and I am correct. I will add this to my blog too.
    Web Hosting Service

  • http://www.web-hosting-service.in Web Hosting Service

    I have seen this recent posts on many blogs lately and I was wondering how this was possible. I thought it was because of a addon or widget and I am correct. I will add this to my blog too.
    Web Hosting Service

  • http://www.imperiousseo.com SEO USA

    It is the nice plug in. and am not much familiar with this..so i want more details about it?

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

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

  • http://pulse.yahoo.com/_QSHGGKAJ4BXVZ3QNUXAZH2YZRI Garry

    I had an issue with getting my widgets to show in the correct way but after reading some of the posts and your article I managed to solve it.
    automatenspiele

  • http://www.hosting-forum.in/ Hosting forums

     thought it was because of a addon or widget and I am correct. I will add this to my blog too.I have seen this recent posts on many blogs lately and I was wondering how this was possible.

  • Anonymous

    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

  • http://twitter.com/mitralowongan Forum Lowongan Kerja

    You have a great way with words as shown in your article. You’re even good with informational content like you have here. I like your views and your writing technique. Keep up the good work, bali!

  • http://profile.yahoo.com/3YFE2UPDXDF3PYMJ67U262K7WM Elwood Pearson

    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

  • http://www.replicon.com/time-bill Project Tracking Software

    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?

  • http://profile.yahoo.com/3YFE2UPDXDF3PYMJ67U262K7WM Elwood Pearson

    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

  • http://www.ozgurhaber.org/ www.ozgurhaber.org

    Thanks for the plugin, love this