Beispiel #1
0
        $end_date = $end_date_dt->format('M j, Y');
        $year = $end_date_dt->format('Y');
        $sponsors = get_sub_field('sponsors', $resident_id);
        $residency_object = (object) array('start_date_dt' => $start_date_dt, 'end_date_dt' => $end_date_dt, 'start_date' => $start_date, 'end_date' => $end_date, 'date_range' => $start_date . '–' . $end_date, 'sponsors' => $sponsors, 'year' => $year);
        array_push($residencies, $residency_object);
    }
    usort($residencies, function ($a, $b) {
        $ad = $a->start_date_dt;
        $bd = $b->start_date_dt;
        if ($ad == $bd) {
            return 0;
        }
        return $ad > $bd ? -1 : 1;
    });
}
if (is_past($resident_id)) {
    echo '<h2>';
    echo 'Past Resident</br>';
    foreach ($residencies as $index => $residency) {
        if ($index != 0) {
            echo '</br>';
        }
        $year = $residency->year;
        $sponsors = get_sponsors($resident_id, $index);
        echo $year;
        if ($sponsors) {
            echo ': ';
            echo $sponsors;
        }
    }
    echo '</h2>';
Beispiel #2
0
echo '<div class="details">';
echo '<div class="left">';
if ($countries) {
    echo '<div class="value country">';
    echo $countries;
    echo '</div>';
}
if ($sponsors) {
    echo '<div class="value sponsors">';
    echo '<div class="vertical-align">';
    echo $sponsors;
    echo '</div>';
    echo '</div>';
}
echo '</div>';
echo '<div class="right">';
if (is_current($resident_id)) {
    if (is_ground_floor($resident_id)) {
        $ground_floor_url = $residents_url . '?filter=all&program=ground_floor';
        echo '<div class="value"><a href="' . $ground_floor_url . '">Ground Floor</a></div>';
    } elseif ($studio_number) {
        echo '<div class="value studio-number">Studio #' . $studio_number . '</div>';
    }
} elseif (is_past($resident_id) && $end_year) {
    echo '<div class="value year">';
    echo $end_year;
    echo '</div>';
}
echo '</div>';
echo '</div></div></div>';
wp_reset_postdata();
Beispiel #3
0
function get_status($id)
{
    if (is_current($id)) {
        return 'current';
    } elseif (is_past($id)) {
        return 'past';
    } else {
        return null;
    }
}
Beispiel #4
0
     //previous current residents by studio number
     insert_neighbor_residents($this_resident_id, 'prev', 1);
     //opened current resident
     setup_postdata($this_resident);
     get_template_part('sections/resident');
     wp_reset_postdata();
     //next current residents by studio number
     insert_neighbor_residents($this_resident_id, 'next', 1);
     // current residents list
     $current_residents_page_id = get_page_by_path('past-residents')->ID;
     $post = get_post($current_residents_page_id, OBJECT);
     $post->delay = 2;
     setup_postdata($post);
     get_template_part('sections/residents');
     wp_reset_postdata();
 } elseif (is_past($this_resident_id)) {
     $past_residents_page_id = get_page_by_path('past-residents')->ID;
     $post = get_post($past_residents_page_id, OBJECT);
     $post->delay = 1;
     setup_postdata($post);
     get_template_part('sections/residents');
     wp_reset_postdata();
     //previous past residents by studio number
     insert_neighbor_residents($this_resident_id, 'prev', 1);
     setup_postdata($this_resident);
     get_template_part('sections/resident');
     wp_reset_postdata();
     //next past residents by studio number
     insert_neighbor_residents($this_resident_id, 'next', 1);
 }
 break;
Beispiel #5
0
    case 'past-residents':
        $classes = 'past-residents residents';
        break;
    case 'greenroom':
        if (is_user_logged_in()) {
            $classes = 'greenroom';
        } else {
            $classes = 'login';
        }
        break;
}
switch ($post_type) {
    case 'resident':
        if (is_current($page_id)) {
            $classes .= 'current';
        } elseif (is_past($page_id)) {
            $classes .= 'past';
        }
        break;
}
$theme = get_template_directory_uri();
if (is_admin()) {
    $fav_dir = 'favicons/square';
} elseif (is_404() || strpos($classes, 'past') > -1) {
    $fav_dir = 'favicons/blue';
} else {
    $fav_dir = 'favicons/orange';
}
$permalink = get_the_permalink($page_id);
$thumb = get_thumb($page_id);
?>