| Server IP : 198.244.165.102 / Your IP : 216.73.216.218 [ Web Server : nginx/1.24.0 System : Linux modovh-ub-01 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64 User : colleary ( 1011) PHP Version : 8.3.23 Disable Function : NONE Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/midwest/public_html/wp-content/themes/midwest-vue-shell/ |
Upload File : |
<?php
/*
Template Name: Schedules Archive Template
*/
get_header();
?>
<?php get_template_part('template-parts/content', 'custom-advertisement'); ?>
<section class="mid-content-wrap main_content_podcasts">
<div class="container">
<div class="row">
<div class="col-md-12 mid-pad-ziro">
<!-- Tab Navigation Start -->
<div class="tabs">
<ul class="nav nav-tabs" id="scheduleTabs" role="tablist">
<?php
$week_days_main = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
foreach ($week_days_main as $index => $day) {
echo '<li class="nav-item">
<a class="nav-link ' . ($index === 0 ? 'active' : '') . '" data-tab="' . strtolower($day) . '" id="' . strtolower($day) . '-tab" data-toggle="tab" href="#' . strtolower($day) . '" role="tab" aria-controls="' . strtolower($day) . '" aria-selected="' . ($index === 0 ? 'true' : 'false') . '">' . $day . '</a>
</li>';
}
?>
</ul>
</div>
<!-- Tab Content Start -->
<div class="mid-home-slider-wrap mid-pad--right-ziro mid-inner-news">
<div class="mid-home-slider-inner">
<div id="schedule-content" class="podcast-content ">
<div class="tab-content" id="scheduleTabsContent">
<?php
// Set up query parameters
$args = array(
'post_type' => 'schedules',
'posts_per_page' => -1,
'post_status' => 'publish',
'meta_key' => 'from_time',
'orderby' => 'meta_value',
'order' => 'ASC',
);
$schedules_query = new WP_Query($args);
$schedules_by_day = [];
if ($schedules_query->have_posts()) :
while ($schedules_query->have_posts()) : $schedules_query->the_post();
$week_days = get_field('week_day');
if (is_array($week_days)) {
foreach ($week_days as $week_day) {
if (!isset($schedules_by_day[$week_day])) {
$schedules_by_day[$week_day] = [];
}
$schedules_by_day[$week_day][] = get_the_ID();
}
}
endwhile;
else : ?>
<div class="col-md-12">
<p>No schedules found.</p>
</div>
<?php endif;
wp_reset_postdata();
// Loop through weekdays and display their schedules
foreach ($week_days_main as $day) {
$day_slug = strtolower($day);
echo '<div class="tab-pane fade ' . ($day === 'Monday' ? 'show active' : '') . '" id="' . $day_slug . '" role="tabpanel" aria-labelledby="' . $day_slug . '-tab">';
if (isset($schedules_by_day[$day])) {
foreach ($schedules_by_day[$day] as $schedule_id) {
$schedule_post = get_post($schedule_id);
?>
<div class="card mb-3">
<div class="row no-gutters">
<?php if (has_post_thumbnail($schedule_post)) : ?>
<div class="col-md-2">
<a href="<?php echo get_permalink($schedule_post); ?>">
<img src="<?php echo get_the_post_thumbnail_url($schedule_post, 'medium'); ?>" class="card-img" alt="<?php echo esc_attr(get_the_title($schedule_post)); ?>">
</a>
</div>
<?php endif; ?>
<div class="col-md-10">
<div class="card-body">
<h4 class="card-title">
<?php
$schedule_title = esc_html(get_the_title($schedule_post));
$from_time_raw = get_post_meta($schedule_post->ID, 'from_time', true);
$to_time_raw = get_post_meta($schedule_post->ID, 'to_time', true);
$from_time = date('g:i a', strtotime($from_time_raw));
$to_time = date('g:i a', strtotime($to_time_raw));
echo $schedule_title . ' - From ' . esc_html($from_time) . ' to ' . esc_html($to_time);
?>
</h4>
<p class="card-text"><?php echo apply_filters('the_content', $schedule_post->post_content); ?></p>
</div>
</div>
</div>
</div>
<?php
}
} else {
echo '<p>No schedules for ' . esc_html($day) . '.</p>';
}
// Add the custom box content for Monday to Friday
if (in_array($day, ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'])) {
echo '<div class="alert alert-info mt-4">
<p><strong>NATIONAL AND LOCAL NEWS ON THE HOUR</strong></p>
<p><strong>DEATH NOTICES AT 8.04am, 10.00am and 5.30pm</strong></p>
</div>';
} else { // For Saturday and Sunday
echo '<div class="alert alert-info mt-4">
<p><strong>NATIONAL AND LOCAL NEWS ON THE HOUR</strong></p>
<p><strong>DEATH NOTICES AT 8.04am, 9.45am and 5.00pm</strong></p>
</div>';
}
echo '</div>'; // Close tab-pane
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<?php get_template_part('template-parts/content', 'google-ads-bottom'); ?>
<?php get_footer('inner'); ?>