This members-only tutorial provides the steps to register a custom condition using which elements in Oxygen can be set to be output before, after or at a specified date or date and time.

The date and time is to be entered in this format: Y-m-d H:i:s.

Ex.: 2021-03-25 16:30:00

With the above (per screenshot) set for a Section, it will be output only after the 25th of March 2021 4:30 pm in the timezone set in WordPress settings.

Note: It is recommended to select a city for Timezone rather than a UTC offset.

If time is omitted, it will be taken as midnight (12am).

Even though Oxygen has built-in Date and Time conditions, as of Oxygen 3.7 they do not use the Date/Time improvements added in WordPress 5.3.

This condition uses the recommended function, current_datetime() and the recommended approach, DateTimeImmutable class.

Also, the built-in Date condition shows the placeholder as MM/DD/YYYY when it should be Y-m-d. Date entered in MM/DD/YYYY format in the built-in Date condition will not work.

Step 1

Install and activate Code Snippets plugin.

Go to Snippets > Add New.

Title: [Condition] Date and time


This is a premium members-only content.

To view the rest of the content, please sign up for membership ($47/month or $399 one-time).

Already a member? Log in below or here.

Need help implementing a tutorial in your site or want to hire me for custom work?


Find the article helpful and wish to donate?



You need to be logged in to view and post comments.
Not a member yet? Join here.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: