Since there is no global variable (that can be used in a conditional statement) that outputs just the current day of the week, I created a snippet called current_day that includes:
{current_time format="%l"}
When testing the output of this snippet in a template as {current_day} it outputs correctly when placed inside OR outside of the EE channel entry loop. I’m seeing Monday, Tuesday, etc. based one what day it is.
The trouble comes when I try to include {current_day} in a conditional statement. I am trying to show different content based on which day of the week it is. For example:
{if current_day == "Monday"}
// get monday content //
{if:elseif current_day == "Tuesday"}
// get tuesday content //
{/if}
When I do this, the condition is never met.
If instead, just to test, I use:
{if current_day}
// get monday content //
{/if}
This returns true, so something is being passed through current_day, but clearly it’s not the day of the week as it is outputting on the same template by using {current_day}.
I’ve tried every combination of using curly brackets, parenthesis and quotation marks just to make sure there was not some funny syntax that needed to be used with snippets. No luck with any of them.
I’m stumped. This is the simplest conditional logic imaginable, and I know the snippet is working, so I have no clue how this doesn’t work.
Ideas?