From Dan, 10 Years ago, written in Plain Text.
This paste is a reply to sort custom posts by custom meta value data from Dan - go back
Embed
while ($sunday_query->have_posts()) : $sunday_query->the_post();
        
        $sort_array = array();
        $schedules = get_post_meta($post->ID, 'show_sched', false);
        $title = get_the_title();

        foreach($schedules as $schedule):

                $theday = $schedule[0]['day'];
                $theorder = $schedule[0]['start_hour'];

                foreach($schedule as $key => $value):

                        $sort_array[$theorder] = $schedule;

                endforeach;

    endforeach;

        ksort($sort_array, SORT_NUMERIC);

        foreach($sort_array as $sort) {
                
$sort):
                
foreach($sort as $key => $value) {
$value):
                        $day = $value['day'];
                        $order = $value['start_hour'];
                        if($day == 'Sunday') {
'Sunday'):
                                echo $day.', '.$order.', '.$title;
                                echo '<br>';
                        }
                }
        }

endif;
                endforeach;
        endforeach;

endwhile;