Home › Forums › Add-ons › Repeater Field › Sort by date a repeater field › Reply To: Sort by date a repeater field
Ok thank you for the explanation, here is what I achieve
<? function my_acf_load_value( $value, $post_id, $field ) {
$order = array();
if( empty($value) ) {
return $value;
}
foreach( $value as $i => $row ) {
$order[ $i ] = strtotime($row['field_5794d01d5c71a']);
}
array_multisort( $order, SORT_DESC, $value );
return $value;
}?>
<? add_filter('acf/load_value/key=field_5794d01d5c71a', 'my_acf_load_value', 10, 3);?>
So far, the order of the content doesn’t seem to change.
I can’t seem to find where the problem come from, any idea ?
Thank you very much @James
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We’re reaching out to our multilingual users to ask for help in translating ACF 6.1. Help make sure the latest features are available in your language here: https://t.co/TkEc2Exd6U
— Advanced Custom Fields (@wp_acf) May 22, 2023
© 2023 Advanced Custom Fields.
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.