It's been a solid year since my last ee project. The things you forget over time :)

At the top of my template I show the latest featured entry (limit="1" search:featured="yes"). Later in my template I'm showing all entries but need to add an additional class to the above featured entry.

By enabling php on the template I can save the entry_id in a variable and then check it in the lower exp:channel:entries.

Are there any issues with enabling php for something minor like this - performance, security? Is there a better way to hold this value?

Thanks! Amanda

3 Answers 3


You'll need an embed, with or without stash.

I always prefer to not use add-ons if I can. So, without stash:

{exp:channel:entries status="featured" limit="1"}
    <div class="featured">
    {embed="entries/.list" featured_id="{entry_id}"}
    {if no_results}
        {embed="entries/.list" featured_id="0"}

On the embed entries/.list:

{exp:channel:entries status="featured|open"}
    <div {if entry_id == {embed:featured_id} }class="featured" {/if} >


I'm reading this as you have two different channel:entries tag where the first tag only displays the featured entries and the second tag displays all entries. If this is correct then you can use a conditional inside the second tag go do what you want as per my example below.

<div class="whatever {if featured="yes"}my_class{/if}">
more code

If I have misread, please clarify wiht more details and/or template code.

You could also look at using Stash if the above isn't what you need, but I've never been able to fully grok Stash.

  • You're mostly correct. But over time there could be many entries that are marked featured. I highly doubt a user will find the previous featured entries and set the field to "no". So I want to say {if entry_id == $saved_entry_id_of_featured_entry_shown_above}. But what's the best way to hold that value? Commented Jul 11, 2013 at 16:45
  • Amanda, In that case you'll want to look at Stash. I know it does what you want, but I haven't been able to figure it out. Am planning on attending 2 sessions on Stash at EECONF this October.
    – CreateSean
    Commented Jul 11, 2013 at 17:35

Just to add the alternative, an example using Stash:

{exp:channel:entries channel="your_channel" limit="1" status="Featured"}

    {exp:stash:set name="cached_featured_entry_id" trim="yes" output="no"}



{exp:channel:entries channel="your_channel" status="open|Featured"}

    <p {if {exp:stash:get name='cached_featured_entry_id'} == {entry_id}}style="font-weight:bold;"{/if}>


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.