I'm trying to find a way to highlight the 10 most recent entries within an alphabetically sorted list of entries from a particular channel.

I don't wish to change the order of the entries, just have the ability to put some custom markup around the most recent ones.

Is there a simple way to do that or am I going to need to use a custom query instead of using channel:entries tag pair?

I'm currently thinking along the lines of having to do a query to get the entry IDs of the most recent 10 entries, storing those entry IDs and comparing them to the entry IDs when outputting my full list.

There's got to be an add-on for this though right?!

2 Answers 2


Try to use embed to set and pass ahead a variable:

{embed="template_group/.entries-list" eleventh="{exp:channel:entries offset='10'}{edit_date format='%U'}{exp:channel:entries}"}

On the embed template:

    {if {edit_date format="%U"} < {embed:eleventh} }
        <custom markup>
        default markup (...)
    {if {edit_date format="%U"} < {embed:eleventh} }
        </custom markup>
  • Because that would simply mark up the first 10 results that are displayed. If I'm displaying them alphabetically it won't highlight the 10 most recent, it will highlight the first 10 shown. I need to mark up the most recent regardless of the order they are displayed in.
    – foamcow
    Commented May 19, 2013 at 11:53
  • I'm sorry! My bad!
    – Sobral
    Commented May 19, 2013 at 12:56
  • 1
    I fixed my answer. I think it's easier than using an addon, even Stash.
    – Sobral
    Commented May 19, 2013 at 19:40

You can probably do this with Stash.

I haven't tested this code, but it should work.

First, output/stash the entries by date.

{exp:channel:entries orderby="date" ...}
  {exp:stash:set_list name="entries"}
    {stash:is_recent}{if count < 11}true{/if}{/stash:is_recent}

Then instead, sort appropriately using the stash output.

{exp:stash:get_list name="entries" orderby="title" sort="asc"}
  <li {if is_recent}class="recent"{/if}>
  • I was thinking Stash might be involved. Will give this a try asap.
    – foamcow
    Commented May 19, 2013 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.