Thanks James, that was really helpful! I think I must have missed out the $column_id and also not calling the $row properly. I thought I’d add in my finished code in case it helps someone:
<?php
$repeater = get_field('company_rates');
$column_id = array();
foreach( $repeater as $key => $row ) {
$thedate = $row['company_date'];
$column_id[ $key ] = strtotime($thedate);
}
array_multisort( $column_id, SORT_DESC, $repeater );
foreach( $repeater as $row ){
$date = DateTime::createFromFormat('Ymd', $row['company_date']);
echo ' <article class="item">
<span class="metaDate">'.$date->format('d / M / Y').'</span>';
// This is pulling in a (company) relationship field I have
$posts = $row['company'];
if( $posts ):
foreach( $posts as $post):
setup_postdata($post);
echo '<h2><a href="'.get_permalink().'">'.get_the_title().'</a></h2>';
endforeach;
wp_reset_postdata();
endif;
echo ' <span class="bigPecent">'.$row['percentage_number'].'%</span>
</article>';
}
?>