This Pro tutorial provides the steps to display elements in Bricks conditionally based on the specified day of the week.
This could be used for example, to automatically display a notice only on Fridays.
Step 1
Go to Settings → General and set the Timezone to the city where your site/business is based at.
Leave the Week Starts On at the default Monday. This is not mandatory since we are going to set the same in code. So it's just a way to make sure there is consistency.
Step 2
Let's add a custom function that takes a 3-letter string of the day (like Mon or Fri) as the input and returns true if today is that specified day.
Sridhar Katakam is a Bricks enthusiast. He likes helping others by researching and solving WordPress-related problems and building websites.
Get access to all 632 Bricks code tutorials with BricksLabs Pro
Related Tutorials..
Conditional Rendering for Logged in/out Users by CSS Classes in Bricks
This tutorial shows how Bricks builder's bricks/element/render filter can be used to conditionally output elements having a class of logged-in to logged-in users only and…