ACF date as conditional

Cross posting in the ACF forum.
Trying to put a display conditional for ACF fields. I’ve created an ACF date field. My problem is finding a way to condition the appearance of a BB module based on that date. I’ve put in a date greater than today. I’ve tried to create a conditional where that ACF field is ‘greater than’ and that’s where I think I’m failing. I’ve tried using the conditional ‘Today’. I’ve tried ‘$Today’ Any ideas on how to get a module to appear or not based on an ACF date?
Thanks.

Not sure if Themer Conditional logic handles ACF date.
But Easy ACF for Themer does: Easy ACF Connect For Themer – WordPress plugin | WordPress.org
You’ll still need to fetch the current date in the last field of the condition (today): maybe with a shortcode, if it’s parsed in this context.
I hope it helps.

Actually it seems to work with the BB Theme current date shortcode in the last field:
[fl_year format=“m-d-Y”]
See BB Doc: https://kb.wpbeaverbuilder.com/article/639-beaver-builder-theme-shortcode-for-current-date

Hi. Thx for the reply. However, the problem with this solution is that it’s a fixed date approach. I need it to be a conditional that fits in with Themer that uses concepts like ‘today’ or ‘tomorrow’ so that we can tie the rule to any post that uses the block. Basically, I’m trying to use that date to hide the block on a given date.
Again, thanks for reaching out.

Hmm, not sure to get you…
The date generated by the shortcode is dynamic, isn’t it?
Unless i missed something, it will output “today”, the current date.
Didn’t you want to compare a fixed date set in the post using an ACF Date picker to the current date?

See my test: https://wpdemo4.avanti.fr/fr/brouillons-test/test-page-16/

I think you understood me, I did not understand you :frowning: My bad!
I still don’t understand how the themer module gets 'today’s date. In your example, you put an actual day 06-09-2020. How does that day get populated? Maybe I should install Easy ACF and test.
Et merci !!

06-09-2020 is the current date output by the shortcode, the same that i use in the conditional logic.

So if you want to compare the ACF static date set on the post to the current date, and display the module depending if the post date is anterior or posterior to the current date, it should be fine.

All you need is the extra Themer free plugin to support dates.

To be clear, the shortcode outputs 06-09-2020 today and will output 06-10-2020 tomorrow, it’s dynamic.

1 Like

THANKS for your help!

Well. Unfortunately, I can’t seem to get it to work :frowning: I’ve created the field, I’ve put the format to d/m/Y, I’ve gone to the page, I’ve put in the expiry date of 6/6/2020, I’ve gone to my themer module and put in the conditional as per the attached image, but it still will not hide the row. Still digging…

Do you use BB Theme? The shortcode is from this theme, it won’t work with another.

If yes, check the date format output by the shortcode by inserting it in an HTML module and see the result displayed.
Then check if the date has a similar format as the one used in your ACF Date.

Also, i noticed you use ACF Date Picker in the condition while i simply use Date, maybe it makes a difference.

More tests… :wink:

Anyway, it works in my tests.

[Update] Date Picker and Date seem the same in Easy ACF, possibly a translation difference.
In the shortcode, you use d/m/Y while i use m-d-Y, not sure it makes a difference but…

Thanks again. I’ll check all your suggestions. And yes, I use BB Theme (obviously the Child theme). Also, I noticed date vs date picker but I don’t have an option for date; I just have date picker. Will test some more…

Right, there’s only a Date Picker field in ACF (or Date Time): https://www.advancedcustomfields.com/resources/

So i guess your issue might be related to the two dates formats not matching, hence they could not be compared(?)

Hello

Thanks for your input. I’ve tried the solution presented by @avanti , it doesn’t work.
I installed the plugin, I have the same date format on both plugin and custom field but it still doesn’t show.

Any other recommendations ?

Thanks

When I saw this was possible I was pretty excited but then found that it didn’t work. I’m also using Y/m/d as the date format.

What’s interesting is both of my date formats are using:

Yes right, it doesn’t seem to be reliable for dates indeed.
I guess comparing dates is difficult depending on the format and other criteria.
Try to contact Easy ACF plugin maybe, and BB support?