Home Forums General Issues Date-sorted agenda with forthcoming/past sorting


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: [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:

    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:, 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
    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

    show Forthcoming_Events_Table
    sort table by ASC

    show 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.


  • hello,
    will do and ask more specific questions here if needed…


Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Date-sorted agenda with forthcoming/past sorting’ is closed to new replies.