$post->event_artist = $event_artist; $events[$post->ID] = (array) $post; } wp_reset_postdata(); usort($events, function ($a, $b) { return $a['event_date'] - $b['event_date']; }); // get programming $programming = array(); $programming_dates = array(); $programming_dates_args = array('post_type' => 'cab_prgm_dates', 'category_name' => $year, 'posts_per_page' => -1); $programming_dates_query = new WP_Query($programming_dates_args); while ($programming_dates_query->have_posts()) { $programming_dates_query->the_post(); $date = get_field('prgm_date', $post->ID); $related_programming = cptr_populate($post->ID); foreach ($related_programming as $r) { $r->event_time = get_field('programming_time', $r->ID); $r->ticket_link = get_field('programming_ticket_link', $r->ID); $programming[$date][] = (array) $r; } } // get locations $locations = array(); $location_args = array('post_type' => 'cab_locations', 'category_name' => $year, 'posts_per_page' => -1); $location_query = new WP_Query($location_args); while ($location_query->have_posts()) { $location_query->the_post(); $location_key = get_field('location_key', $post->ID); $post->location_key = $location_key; $locations[$post->ID] = (array) $post;
function cpr_populate($id) { _cptr_deprecated_function(__FUNCTION__, '2.2', 'cptr_populate'); return cptr_populate($id); }