Support

Account

Home Forums Add-ons Repeater Field Festival events sorted by date/time by using posts and repeater field Reply To: Festival events sorted by date/time by using posts and repeater field

  • Hi @mariol,

    You can use wp_query to call in specific posts using the meta_query parameter. There are some pretty shiny examples of this here. Check out number 4 for sub-fields.

    https://www.advancedcustomfields.com/resources/query-posts-custom-fields/#example-5

    What this would do is to give you all the posts that have band dates in on the set date. This will only do half of the job you need though, as it’s likely that a band will play twice on one day at different times.

    Run the first query and within the loop I’d probably set an array to save the time as the key and the post ID as the value. This then allows you to use krsort(), which will arrange the array in descending order by the key. You can then do a loop through the array, and use the array value of that post’s ID to grab the band name / images / etc. from that particular post, and then output the key afterwards as the time they go on-stage.

    Hopefully that gives you some things to go on, but if not let me know and post some code and we can see what’s going wrong and where.