janizde/WP-Opening-Hours

Suggestion for overview

Closed this issue · 4 comments

The overview normally says for closed status: ”we will open again weekday (date here) from starthour to endhour.”

This message is a bit awkward if we are already on the day mentioned on the message, like early morning or in the break hours. The message should read ”we will open again today from starthour to endhour” instead.

you can write your own?
"We're open again on %2$s (%1$s) from %3$s to %4$s"
or you could use show_today="always" and not show the next one - Then you can format the today string however you want.

We are still closed. If we open tommorow then the default message is OK.
"We're open again on %2$s (%1$s) from %3$s to %4$s"
If we open later today, it should read:
"We're open again today from %3$s to %4$s"
Here "today" should replace "on %2$s (%1$s)"

The message should change at midnight. Of course I need to also reset the cache at midnight to make sure cached pages reflect reality.

You can use the op_is_open_format_next filter https://github.com/janizde/WP-Opening-Hours/blob/master/doc/filters.md#op_is_open_format_next to implement your custom behavior. It is currently not possible through the widget form.

In your filter you can get the current date with OpeningHours\Util\Dates::getNow and then compare the date with the data from $nextPeriod

Great!