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!
Our guide looks into WordPress custom fields and how they stack up against the possibilities of ACF.
— Advanced Custom Fields (@wp_acf) July 18, 2022
https://t.co/hk3yibkHyk
© 2022 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.