Home › Forums › General Issues › Date-sorted agenda with forthcoming/past sorting
Hello,
First, thanks for an amazing plug-in. I started as a complete newbie in php (I still kinda am) and managed to do everything I wanted so far with ACF (and CPT UI) plugin.
Now, I am building an event (race) database, in which amongst other info, I have a date picker field.
What I would like to do is to have an archive page that will look like a calendar (agenda view) which will list the races based on their date value. BUT, I would like to separate it in “forthcoming events” and “past events” (comparing to today’s date and moving events to past automatically). In addition, for “past events” it would be great if I can further separate them by year.
Essentially, I want to recreate exactly this: http://www.justrunlah.com/calendar [this was created by another plugin, but I want to migrate it to our custom fields instead]
This is how one of my custom pages looks like: http://www.justrunlah.com/blog/race/standard-chartered-marathon-singapore-2013/
As I said before, I am not an expert with php but a bit comfortable with coding.
I already know how to make an archive (for example I’ve done this: http://www.justrunlah.com/blog/singapore-running-events-db/, just not sure how to translate the above application to php/wordpress.
I don’t know if that help, but the code in my mind will look like this:
if race_date > today
print race_title on Forthcoming_Events_Table
else
if 1/1/2012 <= race_date <31/12/2012
print race_title on 2012_Events_Table
if 1/1/2013 <= race_date <31/12/2013
print race_title on 2013_Events_Table
endshow Forthcoming_Events_Table
sort table by ASCshow 2012_Events_Table
sort table by DESC (latest events on top)show 2013_Events_Table
sort table by DESC (latest events on top)
Hi @JustRunLah
Can you please read over the date field documentation and query posts articles?
These will provide a good starting ground for you to write this custom query / template.
Thanks
E
hello,
will do and ask more specific questions here if needed…
thanks
The topic ‘Date-sorted agenda with forthcoming/past sorting’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.