Hiding elements based on a date - but not the way you think

Hey guys!

I have watched the video you released about how to create a calendar with ACF Pro and Cornerstone and it’s great. I could follow along fine but at the end of the video Josh explains how to only show future events and hide past ones. What I need is an archive with all past and future events visible - only past events get a semi transparent white div on top of the event to make people understand that these are in the past. People should still be able to click on past events to see more info. The way I set everything up is that I created the archive layout and pulled in the ACF Pro info from the post type events and display them as cards. In each column there is a div that wraps around each card to get the layout right and in the div there’s another div with a semi transparent background set to position absolute covering the whole card to “gray” it out. I want this div to only be there if the event date is before the current date. I tried conditional logic with current Date and the dynamic content of the event date field but it doesn’t work. Why is that? Have I missed something? Also - I can’t use a query on the looper provider to hide the element because I still want it to be in the archive.

Best Umberto

The logic I used is

{{dc:acf:post_field field=“evento_fecha”}} BEFORE {{dc:global:date format=“d/m/Y”}}

(evento_fecha is the event date)

The ACF date picker field is set to the same output format (d/m/Y) and the Wordpress setting too. The div is still showing on a future event.

Hello @umbertofederico,

Thanks for the very detailed post information. You may need to use this condition instead:
{{dc:acf:post_field field="evento_fecha" type="date" format="d/m/Y"}} BEFORE {{dc:global:date format="d/m/Y"}}

Kindly let us know how it goes.

Hey good morning. Thanks for the quick reply. I did change it but nothing happens. Do I have to create another looper provider that picks up on the form field being a date?

I set a looper provider on the section to order the output so that the newest event comes first.


Any idea why this isn’t working? :sweat_smile:

Hey @umbertofederico,

Please provide us your WP details so that we can check your element settings instead. You can create a secure note in your next reply with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
– Confirmation that we can access and make changes to your site

To know how to create a secure note, please check this out: How The Forum Works


Best Regards.

Ok I’ll set it up in a bit and send you the credentials

It’s the archive page “Eventos”.

Hey @umbertofederico,

The conditions is actually working:
{{dc:acf:post_field field="evento_fecha" type="date" format="d/m/Y"}} BEFORE {{dc:global:date format="d/m/Y"}}

None of the event items is dated after today’s date.

Hope this helps.

I am not sure what you did to make it work on your side - on my screen it looks like on the screenshot. Also - why is the date on there twice?

Also how is none of the events dated after todays date? I’m setting the date in the post type in a custom field and referencing that field within the archive page. The publish date doesn’t matter here - the event date does. :sweat_smile:

Just for fun I added the current date to the bottom row to see what “current date” gives me and it seems correct. So logically everything BEFORE today should have the white overlay, everything AFTER today shouldn’t…but still does. Oh and 1/12/2023 is December 1st 2023 so yeah - it is in the future :sweat_smile:

This is the Worpress setting for the date format - just for reference

Screenshot 2023-11-11 081822

Any other hint you could give me? I need this to work until tomorrow night :sweat_smile:

Hi @umbertofederico,

I have checked your website but didn’t find the date showing twice, also not find any further problem. If you are still having any issues, please let us know for further investigation.


In the screenshot I got from you the date was showing twice - that’s why I asked. I changed the whiteout div for an intermediate solution since I didn’t hear back from you but I would still get it to work meaning that past events should get a white semi transparent div on top of the card which is set to transparent on mouse over. However the query that compares the event date to the current date still does not work.

See the attached screenshot:

The div “Past Event Cover” on posts with the past dates should be visible but it is not

Is there a solution to this? Please be so kind to get back to me on this cause I have to present the site tonight and I need it to work. :frowning:

I think the date format was throwing it off. If you are using a timestamp too, you want to use a number comparisons. On your archive I’m using format="c" which converts it to an ISO date and fixes your condition issue. Let us know if this helps.

{{dc:acf:post_field field="evento_fecha" type="date" format="c"}}

Hey Charlie. No not really - my date format is messed up. See the screenshot

Screenshot 2023-11-15 165346

The thing is - the date is not inserted manually. Well - it’s not typed in. I use an ACF date picker field for the date and it has the format d/m/Y selected - also as the output. Why doesn’t Cornerstone get that?


I saw you changed the output to custom and “U” - whatever that is. :sweat_smile: I changed it back because I need the date to appear correctly.