• Resolved nitrospectide

    (@nitrospectide)


    I had started this post looking for support, but then I realized my problem, and now have it working… so I wanted to document the solution for anyone else who is looking to do this.

    GOAL: A list of upcoming events that only shows events starting after today’s date, and shows them in ascending order so that the next upcoming event is first, the following event is second, etc – all by date. This date ordering is based on an ACF date field (the date of the event) and not the post publish date.

    First, I’ll start with showing only items that happen after today. I did this by comparing the ACF value against today’s date with a > operator. In the Post Meta Query section of the AQL block settings sidebar, I put the name of my ACF date field into the Meta Key field (Be SURE to hit RETURN to submit the value and see it switch to a gray box for this to actually work. Otherwise, the field name will not be saved, and this will confuse the heck out of you). Select the > in the Meta Compare dropdown below there. Next, you need today’s date in the Meta Value field. A user named Lane on this post provided the code for functions.php to dynamically pull today’s date. The code looks for a specific token called todays_date in the Meta Value field, and replaces that dynamically with today’s date.

    Next, for ordering the posts according to the ACF date field, I followed Ryan’s initial reply here. I already have the ACF field name in the Meta Key field because of what I did in the first step above. Now I need to choose Meta Value Num in the Post Order By dropdown above the Post Meta Query section. Don’t confuse this with the Order By dropdown further up in the sidebar. Finally, toggle the Ascending Order toggle just beneath the Post Order By dropdown.

    Voila!

    My settings:

Viewing 4 replies - 1 through 4 (of 4 total)
  • Oh man…so very much this:

    ?(Be SURE to hit RETURN to submit the value and see it switch to a gray box for this to actually work. Otherwise, the field name will not be saved, and this will confuse the heck out of you).

    Thank you very much for sharing!

    Plugin Author Ryan Welcher

    (@welcher)

    This is fantastic! Thank you for taking the time to document it

    Plugin Author Ryan Welcher

    (@welcher)

    This looks to be resolved. I’m going to close it but please let me know if there are further issues.

    Thank you !

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.