Support

Account

Home Forums General Issues Get content from CPT posts and reorder it Reply To: Get content from CPT posts and reorder it

  • I can only give you a rough outline of what needs to be done. This would take a good deal of coding.

    When showing a person:

    1. Get all the related films
    2. Loop over the related films and get the data from each film
    3. Build array(s) of data that can be used with either php usort() or php array_multisort() – I would use usort()
    4. Sort the array(s) using either usort() or array_muultisort()
    5. Loop over the sorted array to output the data

    Like I said, I would build a function that works with usort().

    ACF has a basic example of using array_multisort() here https://www.advancedcustomfields.com/resources/how-to-sorting-a-repeater-field/