Wow. That was quick.
??
Ok, I’ve just released a new plugin version (v1.6.1). After the update, please go to custom field’s settings, and set the “Min date” option (in “Datepicker/Weekpicker Type Options”) to something like:
[alg_wc_ccf_if value1="{alg_wc_ccf_datetime format='Gi'}" operator="greater" value2="1300" then="1" else="0"]
This will set the first available date to tomorrow, in case if it’s after 1 PM.
Settings may not look too user-friendly, however, this way we have a lot of customization options. Let me try to explain it a bit more.
So in latest plugin version I’ve added two new shortcodes: [alg_wc_ccf_datetime]
and [alg_wc_ccf_if]
.
[alg_wc_ccf_datetime]
returns current date and time. It has only one attribute: format
. Accepted format is the same as in PHP date function. So this – [alg_wc_ccf_datetime format="Gi"]
– will return 1300
if it’s 1 PM now.
[alg_wc_ccf_if]
allows us to compare values. It has 5 available attributes: value1
, value2
, operator
, then
and else
. Attributes are generally self-explanatory, and possible operator
values are: equal
, not_equal
, less
, less_or_equal
, greater
or greater_or_equal
.
And last note – as we can’t use square brackets []
inside shortcode attributes, we replace them with curly brackets {}
. And similarly, we replace double quotes "
with single quotes '
.
So to sum up – we are taking value1
(current date in Gi
format, e.g. 1310) and checking if it’s greater
than value2
(i.e. 1300
). If it is, we set “Min date” to “1” (i.e. then
), if it’s not, then we set “Min date” to “0” (i.e. else
attribute).
Hope this makes sense. Please give it a try and let me know if it’s working as expected, or if you have any questions.