Support

Account

Home Forums Front-end Issues After upgrade post aggregator not working Reply To: After upgrade post aggregator not working

  • Hi @mpayumo

    It seems you’re using the old syntax for the repeater. Could you please try the new syntax and debug the variables like this:

    while ( have_rows('dates') ) : the_row();
     
        if(get_sub_field('event_date')){
            $post_id = get_the_ID(); // Set the current post ID
            $event_date = get_sub_field('event_date'); 
            $event_location = get_field('event_venue');
            $permalink = get_permalink();
            $thumbnail = get_the_post_thumbnail($post_id);
            $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id($post_id), 'thumbnail');
            $ticket = get_sub_field('event_ticket_link');
            $price = get_field('event_price');
            $title = get_the_title();
            $terms = get_the_terms($post_id, 'genre');
            $url = wp_get_attachment_image_src($id,'event-thumb', true);
    
            if($event_date >= $today){
                if(isset($events[$post_id])){
                    $events[$post_id]['dates'][] = $event_date;
                    if($event_date < $events[$post_id]['earliest_date']){
                        $events[$post_id]['earliest_date'] = $event_date;
                    }
                }
                else{
                    $events[$post_id] = array(
                        'title' => $title,
                        'permalink' => $permalink,
                        'thumb' => $thumbnail,
                        'thumbnail_src' => $thumbnail_src,
                        'price' => $price,
                        'ticket' => $ticket,
                        'dates' => array($event_date),
                        'earliest_date' => $event_date,
                        'terms' => $terms
                    );
    
                }
    
            }
            
            $i++;
        }
        
        echo "<pre>";
        
        echo "======== Start debugging the events variable ========";
        print_r($events[$post_id]);
        echo "======== End debugging the events variable ========";
        
        echo "======== Start debugging the events date ========";
        print_r(get_sub_field('event_date'));
        echo "======== End debugging the events date ========";
        
        echo "</pre>";
    
    endwhile;

    Thanks 🙂