• Hi, this looks like a great plugin. However I am missing to set up condition for a day of the week or month or time. That would be useful to show a message like “10% discount every Friday” or “Buy by 1pm to get the products before weekend”. Would it be possible to implement something like that?

Viewing 1 replies (of 1 total)
  • Plugin Author Gabriel Serafini

    (@gserafini)

    Hi @ochranakorona — the plugin does support showing content on a named day basis. Here’s an example:

    [display_during start_day_time="Fri 12:00 am" end_day_time="Fri 1:00 pm"]PROMO MESSAGE[/display_during]

    The values passed to the start_day_time and end_day_time shortcode attributes are parsed by the PHP strtotime() function.

    It compares the end day / time with the start day / time, and if it’s inside that timeframe it will show the content included inside the shortcode.

    The function expects to be given a string containing an English date format and will try to parse that format into a Unix timestamp (the number of seconds since January 1 1970 00:00:00 UTC), relative to the timestamp given in now, or the current time if now is not supplied.

    To support something showing up just during the month of January for example you should be able to use something like:

    [display_during start_day_time="January 1" end_day_time="January 31"]JANUARY MESSAGE[/display_during]

    If you don’t specify the year bit it will default to the current year.

    Here’s a site where you can test different strtotime() strings: https://strtotime.co.uk/

    I hope that helps!

    P.S. You may want to add timezone to your shortcode attributes if you care about the time reflecting your local timezone.

    timezone_location – OPTIONAL – The timezone uses by default whatever is set for the site in Settings > General. You can use this optional parameter to specify a different timezone location. Uses the standard PHP timezones

    • This reply was modified 4 years, 1 month ago by Gabriel Serafini. Reason: Added timezone note
Viewing 1 replies (of 1 total)
  • The topic ‘Display on certain days of a week’ is closed to new replies.