$args = array('post_type' => 'sunday', 'name' => $date);
    // The Query
    $query = new WP_Query($args);
    // The Loop
    if ($query->have_posts()) {
        ?>
								
                                <div class="grid col-300 not-empty student-shows-wrapper">
                        			<div class="show-third student-shows-box">
                                    <?php 
        $today = date('Ymd');
        $date = DateTime::createFromFormat('Ymd', $today);
        echo '<div class="student-box-top">' . $date->format('F, Y');
        echo '<h3><a href="' . site_URL() . '/shows/student-shows">Student Shows</a></h3>';
        echo '<p>See the future of improv &mdash; <a href="' . site_URL() . '/school">BATS School</a> students come out to play!</p>';
        echo '<p><a href="' . site_URL() . '/shows/student-shows">All student shows&nbsp;&raquo;</a></p>';
        echo '</div>';
        ?>
                                
                                <?php 
        while ($query->have_posts()) {
            $query->the_post();
            echo '<div class="student-list">';
            $today = date('Ymd');
            for ($i = 1; $i < 7; $i++) {
                $date = get_field('date_' . $i);
                if ($date > $today) {
                    echo '<div class="student-show-item">';
                    $date = DateTime::createFromFormat('Ymd', get_field('date_' . $i));
                    echo $date->format('l, M j, ');
                    echo get_field('time_' . $i);
                        </p>

                        <div class="light mini">
                            <p>
                                <?php 
    echo showUsers($catID, hosts, "Hosts: ");
    echo showUsers($catID, formerhosts, "Former hosts: ");
    echo showUsers($catID, staff, "Production staff: ");
    /* Start Subscription Block */
    if (!get_terms_meta($catID, 'inactive', true)) {
        $subscriptionOptions = [];
        if (get_terms_meta($catID, 'feed', true)) {
            $subscriptionOptions['RSS'] = get_terms_meta($catID, 'feed', true);
        }
        if (!get_terms_meta($catID, 'feed', true)) {
            $subscriptionOptions['RSS'] = site_URL() . '/' . $catNice . '/feed/';
        }
        if (get_terms_meta($catID, 'itunes', true)) {
            $subscriptionOptions['iTunes'] = get_terms_meta($catID, 'itunes', true);
        }
        if (get_terms_meta($catID, 'goodreads', true)) {
            $subscriptionOptions['Goodreads'] = get_terms_meta($catID, 'goodreads', true);
        }
        if (get_terms_meta($catID, 'facebookurl', true)) {
            $subscriptionOptions['Facebook'] = get_terms_meta($catID, 'facebookurl', true);
        }
        if (get_terms_meta($catID, 'twitterid', true)) {
            $subscriptionOptions['Twitter'] = "https://twitter.com/" . get_terms_meta($catID, 'twitterid', true);
        }
        echo 'Subscribe: ' . andListKeyed($subscriptionOptions) . '.<br />';
        /* End Subscription Block */
if (get_terms_meta($catID, 'twitterid', true)) {
    echo 'The show also has its own Twitter account at ';
    $showTwitter['@' . get_terms_meta($catID, 'twitterid', true)] = "https://twitter.com/" . get_terms_meta($catID, 'twitterid', true);
    echo andListKeyed($showTwitter) . '.';
}
?>
                </p>

                <div class="light mini">
                    <?php 
if (!get_terms_meta($catID, 'inactive', true)) {
    if (get_terms_meta($catID, 'feed', true)) {
        $subscriptionOptions['RSS'] = get_terms_meta($catID, 'feed', true);
    }
    if (!get_terms_meta($catID, 'feed', true)) {
        $subscriptionOptions['RSS'] = site_URL() . '/' . $category[0]->category_nicename . '/feed/';
    }
    if (get_terms_meta($catID, 'itunes', true)) {
        $subscriptionOptions['iTunes'] = get_terms_meta($catID, 'itunes', true);
    }
    if (get_terms_meta($catID, 'goodreads', true)) {
        $subscriptionOptions['Goodreads'] = get_terms_meta($catID, 'goodreads', true);
    }
    if (get_terms_meta($catID, 'facebookurl', true)) {
        $subscriptionOptions['Facebook'] = get_terms_meta($catID, 'facebookurl', true);
    }
    if (get_terms_meta($catID, 'twitterid', true)) {
        $subscriptionOptions['Twitter'] = "https://twitter.com/" . get_terms_meta($catID, 'twitterid', true);
    }
    echo 'Subscribe: ' . andListKeyed($subscriptionOptions) . '.';
}
/**
 * Displays a list of all shows belonging to a person, based on the
 * relevant meta string. Then outputs them with a displaystring and
 * links to the various shows.
 * @param  [type] $userID        Takes the User's ID.
 * @param  [type] $catString     Takes the Category ID.
 * @param  [type] $displayString Displaystring to prepend to output.
 * @return [type]                Returns a list of the shows matching the user & meta.
 */
function userShows($userID, $catString, $displayString)
{
    $categoryIDs = get_all_category_ids();
    $author = get_userdata($userID);
    $hostShows = [];
    foreach ($categoryIDs as $catID) {
        $hosts = explodedCat($catID, $catString);
        if (in_array($userID, $hosts)) {
            if (!preg_match('/cancelled/', $displayString) && !get_terms_meta($catID, 'inactive') xor preg_match('/cancelled/', $displayString) && get_terms_meta($catID, 'inactive')) {
                $hostShows[get_cat_name($catID)] = site_URL() . '/' . getCatSlug($catID);
            }
        }
    }
    if ($hostShows) {
        return $author->first_name . "'s " . $displayString . ': ' . andListKeyed($hostShows) . '.<br />';
    }
}
Example #5
0
function currentStudent()
{
    $today = date('Ymd');
    $date = DateTime::createFromFormat('Ymd', $today);
    $date = $date->format('F');
    $args = array('post_type' => 'sunday', 'name' => $date);
    // The Query
    $query = new WP_Query($args);
    // The Loop
    if ($query->have_posts()) {
        echo '<div class="grid col-300 not-empty">';
        echo '<div class="show-third student-shows-box">';
        $today = date('Ymd');
        $date = DateTime::createFromFormat('Ymd', $today);
        echo '<div class="student-box-top">' . $date->format('F, Y');
        echo '<h3><a href="' . site_URL() . '/shows/student-shows">Student Shows</a></h3>';
        echo '<p>See the future of improv &mdash; <a href="' . site_URL() . '/school">BATS School</a> students come out to play!</p>';
        echo '<p><a href="' . site_URL() . '/shows/student-shows">All student shows&nbsp;&raquo;</a></p>';
        echo '</div>';
        while ($query->have_posts()) {
            $query->the_post();
            echo '<div class="student-list">';
            $today = date('Ymd');
            for ($i = 1; $i < 7; $i++) {
                $date = get_field('date_' . $i);
                if ($date > $today) {
                    echo '<div class="student-show-item">';
                    $date = DateTime::createFromFormat('Ymd', get_field('date_' . $i));
                    echo $date->format('l, M j, ');
                    echo get_field('time_' . $i);
                    echo '</div>';
                }
            }
            echo '</div><div class="clear"></div>';
        }
        echo '</div>';
        echo '</div>';
    } else {
        // no posts found
    }
    // Restore original Post Data
    wp_reset_postdata();
}