I'm displaying a list of categories, and I want to add a little "new" icon next to the category name if one or more entries in that category have been created in the last day. But I can't figure out how to display code just once if multiple entries return true. I got this far using GWCode Categories and MX Calculator:
{exp:gwcode_categories
cat_id='4'
depth='2'
show_empty='no'
style='linear'
variable_prefix='gw:'
parse='inward'
}
<li>
<a href="{path='topics/{gw:cat_url_title}'}">
{gw:cat_name}
<span aria-hidden="true" data-icon=""></span>
{!-- If an entry in this category has been added in the last day, add the "new" icon --}
{exp:channel:entries
channel='{sp_channels}'
dynamic='no'
category='{gw:cat_id}'
disable='categories|pagination|member_data|custom_fields'
}
{exp:mx_calc expression="{current_time} - 86400"}
{if {entry_date} > {calc_result}}
<b class="new">New</b>
{/if}
{/exp:mx_calc}
{/exp:channel:entries}
</a>
</li>
{/exp:gwcode_categories}
But that outputs the "new" tag once for every entry that passes the conditional.
How do I get the code to output just once if any entries return true?