How to Set Up Non-duplicating Recent Entries

It’s common knowledge by now that a Recent Posts list on the home page of a blog is beneficial for garnering more page views, just as a Related Posts list is for single entry pages. Unfortunately, many of the blogs I’ve seen using this technique are duplicating their most recent entry. Duplicate content is always a concern for blogs, and particularly those powered by WordPress. Fortunately, there’s a fix for it – at least when it comes to recent posts. Here’s how…

Instead of starting with the standard Loop, we’re going to open a query, like this:

This tells WordPress you only want one entry (the most recent) returned by the query, that there’s more to come, and don’t repeat it. Savvy? ;) Note: this will override any settings you have in the Dashboard for how many posts to display on your home page.

Now you should see some recognizable code calling the post title, meta data, and content, or some variation of these functions:

Beyond this you may have a call to your sidebar, some ads, or whatever you’ve dropped in. Just be sure to close your query with an endwhile statement (not endif).

Moving down the page to your Recent Entries section, you’ll need to alter the code a bit more. Again we start with a query, this time with however many posts you want displayed:

Then, where you would normally call the [standard] Loop, alter it like so:

Depending on how you want your list to appear, you may want to include the title and excerpt, the title and post meta, or all three, but it’s basically going to look like this:

  • < a href="">

Whatever additional content you might have.

Not Found

Sorry, nothing found.


You just created a custom index page which will show your most recent entry in full, along with a list of 5 previously featured entries – all without penalty of duplication. Of course, there’s more than one way to do just about everything in WordPress. This is the only way I know of, but if there’s a better way I’d love to hear it!

Update: Suppose you want to do add a list to your single.php page as well? This can be done with a little less code, using another [foreach] loop:

Recently Featured

  • < a href="">

This tells WordPress to display the titles of the most recent 5 entries, prior to the very latest one (which of course will already be displaying in full in the main content section).

This post is tagged: ,


4 Responses to “How to Set Up Non-duplicating Recent Entries”
  1. 11.02.2007

    Nice work Charity. I’ll take an even closer look at this some time when it’s not so late. However, for now…Stumbled!

  2. 11.02.2007

    Thanks Armen. :) By the way, I love the look of your blog! Nice clean layout, very warm. Good work on your designer resource list as well. I’ve also been putting together a list because – like you said – my bookmarks are overwhelming at this point. :) One of these days I’ll get it published…

  3. 11.03.2007

    Thanks for this post, Charity. I’ll be linking over to you from Theme Playground :).

  4. 11.06.2007

    Very nice post, and I second Charity, really nice looking blog.