Home Forums Add-ons Repeater Field order acf repeater-field by datepicker in wp-query Reply To: order acf repeater-field by datepicker in wp-query

  • if you dont try to merge your posts into one list you could try this:

    <ul class="program-list">
    <?php query_posts('cat=2'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    $repeater = get_field('program_repeater');
    foreach( $repeater as $key => $row ) {
    		$thedate = $row['program_repeater_date']; 
    		$column_id[ $key ] = strtotime($thedate);
    array_multisort( $column_id, SORT_ASC, $repeater );
    	foreach( $repeater  as $row ){
    $dateDayNumber = date_i18n("d", strtotime(get_sub_field('program_repeater_date')));
    			$dateMonthNumber = date_i18n("m", strtotime(get_sub_field('program_repeater_date')));
    			$dateDayOrg = date_i18n("l", strtotime(get_sub_field('program_repeater_date')));
    			$dateDay = substr($dateDayOrg, 0, 2);
    			$dateTime = get_sub_field('program_repeater_time');
    			$specialEvent = get_sub_field('program_repeater_special');
    			$mainTitle = get_the_title();
    			$subTitle = get_field('sub_text');
    			$rowSeatsId = get_sub_field('program_repeater_rowseats_id');
    				<div class="specialEvent"><?php if( $specialEvent ): ?><?php echo $specialEvent; ?><?php else: ?>&nbsp;<?php endif; ?></div>
    				<div class="dateDayNumber"><?php echo $dateDayNumber; ?></div>
    				<div class="dateMonthNumber"><?php echo $dateMonthNumber; ?></div>
    				<div class="dateDay"><?php echo $dateDay; ?></div>
    				<div class="v-line-zick-zack"></div>
    				<div class="dateTime"><?php echo $dateTime; ?></div>
    				<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
    					<div class="mainTitle"><?php echo $mainTitle; ?></div>
    					<div class="subTitle"><?php echo $subTitle; ?></div>
    				<a href="<?php the_permalink(); ?><?php echo "?id=" . $rowSeatsId; ?>" title="<?php the_title_attribute(); ?>">
    					<div class="ticket-link">Tickets kaufen</div>
    				<div class="clear"></div>
    <?php } ?>
    <?php endwhile; endif; ?>
    <?php wp_reset_query(); ?>

    If you try to merge them => you need to build a array first, order it, and echo it after that.

    try to adapt a solution like this or this