If I had the same repeater field on a few different pages, what would be the best way to get the repeater field entries from all those pages and combine them, and then sort them all by a field value? Though I don’t yet know exactly how (going to research it), I imagine I could get each repeater field and put its entries into an array and then get the next repeater field and add that onto the same array and then once all repeater fields have been gone through I could sort the array by a particular value… Unless there is a better way?
1. Perform a get_posts query to load and loop through the desired post objects
2. For each post object, load the repeater field data via get_field and add each row to a variable (defined outside of the loop)
3. After your loop is complete, this variable will not hold all your rows of repeater field data
4. Sort the variable just like in this tutorial: http://www.advancedcustomfields.com/resources/how-to/how-to-sorting-a-repeater-field/
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users