Home › Forums › Add-ons › Repeater Field › Repeater sorted by Date › Reply To: Repeater sorted by Date
I think this is on the right track but I am getting this error.
Did I miss something in your example?
Fatal error: Function name must be a string
this is my code
<?php
$repeater = get_field('race_event');
foreach( $repeater as $key => $row )
{
$column_id[ $key ] = $row['race_date'];
}
array_multisort( $column_id, SORT_ASC, $repeater );
$currMonth = "start";
foreach( $repeater as $row ) :
{
$date = DateTime::createFromFormat('Ymd', $row['race_date']);
$website_url = $row['race_website'];
if ($currMonth != $date('F')) :
{
echo '<h2>' . $date('F') . '</h2><br>';
$currMonth = $date('F');
}
endif;
echo '<ul>';
echo '<li><h2>' . $row['race_name'] . '</h2></li>';
echo '<li>Date ' . $date->format('F d, Y') . '</li>';
echo '<li>Distance ' . $row['race_distance'] . '</li>';
echo '<li>Vertical ' . $row['race_vertical'] . '</li>';
echo '<li>URL <a href=' . $website_url . '> ' . $website_url . ' </a></li>';
echo '<li>' . $row['race_description'] . '</li>';
echo '</ul>';
}
endforeach;
?>
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 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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.