Alright, here we go. I need to show opening hours on a website that's currently in development.

I have a nice little ul showing the days of the week:

Monday: 09:00am - 05:00pm

Tuesday: 09:00am - 05:00pm

And so on.

What I'd like to do is add a class to the li if it's currently that day, so that on Tuesdays the line reading "Tuesday: ..." is highlighted.

Something like:

{{ opening_hours }}

  <li class="item {{ if something }} highlight {{ /if }}">
    {{ day }}: {{ hours }}

{{ /opening_hours }}

Is there a way to do this with nifty if/else antlers, or should I start dusting off my PHP snippets?


Answered by Daniel Saksa! Go to answer.