Hi,
I've been trying to display the dates added in a subfield but only if they are in the future. The site is events driven. The problem for me is there can multiple instances of one course.
To make it easy for the sites admin I've created a repeater where they add the start date for the course.
I'd like to only display course dates in the future and potentially order by the first date.
I've got this far, which isn't very far but I've been doing this all day. Managed to sort it, if the courses aren't in a repeater but I can't set it up that way.
W
I've been trying to display the dates added in a subfield but only if they are in the future. The site is events driven. The problem for me is there can multiple instances of one course.
To make it easy for the sites admin I've created a repeater where they add the start date for the course.
I'd like to only display course dates in the future and potentially order by the first date.
I've got this far, which isn't very far but I've been doing this all day. Managed to sort it, if the courses aren't in a repeater but I can't set it up that way.
<?php $today = date('Ymd');<br /> if( get_field('course_dates') )
{
while( has_sub_field('course_dates') )
{
$date = get_sub_field('multiple_dates');
$do_current = ($date > $today); // Check that the post's date is larger that today's date
if ( $do_current || $continue )
echo $date . ' ' ;
}
}
?>
W