In version 2.0.8, WPCode added the ability to schedule when a snippet is active on your site based on the current time. While you can easily add a start & end date using the Insertion schedule options you can also create more advanced schedules using the Smart Conditional Logic options available for scheduling.
The conditional logic rules can be combined to create more powerful or specific schedule patterns or even recurring schedules.
What options are available?
The 4 main Scheduling options for conditional logic are:
- Date – this allows you to create a rule based on the calendar date, like February 23rd of 2023, and use operators like “is, is not, is before, is after, is on or after and is on or before”.
- Date & Time – this options is similar to the Date one but also allows you to pick a Time of that specific date
- Day of the Week – With this option you can pick which dates of the week to include in your conditions, combined with date parameters or not for recurring schedules.
- Current time – Using the current time option you can create time based rules outside of a specific date, for example show a message only after 9AM.
Now that the 4 options are more clear, here’s a classic example that only uses the Day of the Week and Current Time options.
Display a message from 9 to 5 Monday to Friday
For this type of schedule you will have to combine the Day of the Week option with the Current time allowing you to create a recurring schedule for when a snippet is active. Here’s a preview of how that setup looks:
But there’s more, because you can also combine the above with the Date parameters you can make sure that the same message is not displayed in the first week of August, if, let’s say, your company is closed at the time and instead use another snippet to display an appropriate message on those dates.
If you are looking for other scheduling scenarios and run into issues setting it up, don’t hesitate to reach out to our support team and we’ll gladly help you set it up.