Home › Forums › Add-ons › Repeater Field › Repeatable events ordered by date from repeater field › Reply To: Repeatable events ordered by date from repeater field
first thing is that I do not see a have_posts() loop in your code, but this will not matter.
It is impossible using WP_Query() to list a post more than once. It is also impossible to order posts by a repeater sub field. So you’ve basically set an impossible task for yourself using only these things and it requires something much more complex.
In order to show a post multiple times, well, basically you need multiple posts. If you look at the way others have done this you will find that they also have a second post type that is hidden from users. When an event is saved what happens is that a new post in the hidden post type is created for each of the dates entered when creating the event and each of these posts is related to the event post (parent). Then the archive page for events actually uses this post type to get all of the events listed in the correct order and pulls most of the data from the “parent” event.
There are likely other ways to do this, but the method I’ve described is used by the most popular events plugin.
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!
❓Ever wondered when and why ACF uses JSON instead of the database? Check out our summary of the most recent session of ACF Chat Friday for the answer, and make sure to register for the next session.— Advanced Custom Fields (@wp_acf) February 23, 2023
© 2023 Advanced Custom Fields.