Display upcoming and past events with Divi Engine and ACF.
This feels like such an important feature for client work as a web developer, so why is it buried in the Divi Engine documentation?
Well, maybe it's not buried, maybe I just wasn't wording my google search right, and I'm a little salty about how long it took me to figure this out.
The Goal
To ONLY display either upcoming or past events using Divi Engine and ACF.
What you need
Divi theme and builder
Divi Engine plugin
Advanced Custom Field plugin
Step 1: Use ACF to create a date picker field for your event posts.
Using ACF, create a new field and choose the "Date Picker" field type.
For more information about the date picker, you can check the docs here
Step 2: Using the Divi Engine archive loop, sort by the date picker field you made in step 1.
This blog assumes you already have the posts displaying, so we are going to skip over making a post loop layout and whatnot.
When you open the archive loop, go to Loop Options > Sorting.
Then in the "Sort Order" dropdown, choose "ACF Date Picker"
Once you have that picked, a couple new options should have popped for you, like ACF Date Picker, and ACF Date Picker Method.
Step 3: Display either Upcoming Events or Past Events
From here it's pretty straight-forward. In the ACF Date Picker drop-down, you'll choose the field that you made in step 1. (Just a note: you'll need to have something inputed into the fields for each event for this to work)
Then for the ACF Date Picker Method, if you want upcoming events, you'll choose "Today and in the future" and for past events choose "In the past". It's also good to take note of some of the other options you have here, they could come handy in the future!
After you confirm the changes and hit save, you may need to refresh to see the end result.
That's it! If you're interested in a shorter version of this, this is the article on the Divi Engine docs that helped me with this.
Something I took away after learning this is -- It's pretty beneficial to just click through the modules on Divi Engine or the Divi Engine docs and see what's available. There's a ton of stuff like this that I wish I knew was possible a long time ago.
Subscribe to my newsletter
Read articles from Zachary Luke directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by