Add class to post posted on current date

When working on this Blog i wanted to add class="new" to snippets that were posted on current date. Solution was found by Peciura like this.

{assign var='current_date' value='Y-m-d'|date}
{foreach from=$items item=entry}
    <a class="{if startswith($entry->postdate, $current_date)}new{/if}" title="{$entry->title|escape:htmlall}" href="{$entry->detail_url}">{$entry->title|escape}</a>
{/foreach}

Comments