- <?php
- /**
- * The template for displaying all pages.
- *
- * This is the template that displays all pages by default.
- * Please note that this is the WordPress construct of pages
- * and that other 'pages' on your WordPress site will use a
- * different template.
- *
- * @package _tk
- */
- get_header(); ?>
- <?php while ( have_posts() ) : the_post(); ?>
- <?php do_shortcode('[master-schedule]'); ?>
- <?php // get_template_part( 'content', 'page' ); ?>
- <?php // echo do_shortcode('[list-shows]') ?>
- <?php
- wp_reset_query();
- // get today's date
- $today = date('Y-m-j');
- // what week of the month does today's date fall within - single integer (1-5)
- $currentweek = getWeeks($today, "sunday");
- echo $currentweek;
- $args = array(
- 'post_type' => 'show',
- 'posts_per_page' => '-1',
- );
- query_posts( $args ); ?>
- <div id="station-show-list">
- <ul>
- <?php while ( have_posts() ) : the_post();
- // the show date
- $schedule = get_post_meta($post->ID, 'show_sched', true);
- $theday = $schedule[0]['day'];
- // the show week
- $week = get_field('show_frequency');
- $firstrun = $week[0];
- $secondrun = $week[1];
- if($firstrun == $currentweek) {
- echo '<li>';
- echo '<h2>Monday</h2>';
- if($theday == 'Monday') {
- echo the_title();
- }
- echo '</li>';
- echo '<li>';
- echo '<h2>Tuesday</h2>';
- if($theday == 'Tuesday') {
- echo the_title();
- }
- echo '</li>';
- echo '<li>';
- echo '<h2>Wednesday</h2>';
- if($theday == 'Wednesday') {
- echo the_title();
- }
- echo '</li>';
- echo '<li>';
- echo '<h2>Thursday</h2>';
- if($theday == 'Thursday') {
- echo the_title();
- }
- echo '</li>';
- echo '<li>';
- echo '<h2>Friday</h2>';
- if($theday == 'Friday') {
- echo the_title();
- }
- echo '</li>';
- echo '<li>';
- echo '<h2>Saturday</h2>';
- if($theday == 'Saturday') {
- echo the_title();
- }
- echo '</li>';
- echo '<li>';
- echo '<h2>Sunday</h2>';
- if($theday == 'Sunday') {
- echo the_title();
- }
- echo '</li>';
- } elseif ($secondrun == $currentweek) {
- } else {
- echo '<div>';
- echo the_title();
- echo '</div>';
- }
- endwhile; // end of the loop.
- echo '</ul></div>';
- wp_reset_query(); ?>
- <?php endwhile; // end of the loop. ?>
- <?php // get_sidebar(); ?>
- <?php get_footer(); ?>
Stikked
