How is it possible to order the admin repeater fields ?
Something like the admin post list (click the title to sort by the title etc’)
i also would know if it is possible to auto order repeater fields at backend, based on a value inside that repeater (oder by a date-field for example)
at frontend i have no big problem. i do it like this:
foreach( $arr_merge as $key => $row ) {
$thedate = $row['termin_date'];
$column_id[ $key ] = strtotime($thedate);
}
array_multisort( $column_id, SORT_ASC, $arr_merge );
but at backend i dont know, how to do that.
if there where not may repeater rows, manually order is no big thing, but if you have about 10-100 repeater-rows, automatic order would be great. even if it would happen only after a save/update the post, not after add row.
You can use a filter like:
add_filter('acf/load_value/type=repeater', 'my_acf_load_value', 10, 3);
function my_acf_load_value( $rows)
{
array_multisort($rows, SORT_ASC);
return $rows;
}
Now you just have to build a select menu and hook to the specified action..