Home Forums Add-ons Repeater Field Combine results from multiple repeater fields


Combine results from multiple repeater fields

  • 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?


    • Elliot

    • December 11, 2013 at 10:41 am

    Hi @AKA Digital

    To achieve the above, you would:

    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:

    Good luck


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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.