示例#1
0
<?php

global $post;
setup_postdata($post);
$resident_id = $post->ID;
$title = get_the_title($resident_id);
$countries = get_countries($resident_id);
$resident_status = get_status($resident_id);
$bio = get_field('bio', $resident_id);
$residents_url = get_permalink(get_page_by_path('residents'));
$studio_number = get_field('studio_number', $resident_id);
$residency_program = get_field('residency_program', $resident_id);
$sponsors = get_sponsors($resident_id);
$url = get_permalink();
if ($bio) {
    if (have_rows('residency_dates', $resident_id)) {
        while (have_rows('residency_dates')) {
            the_row();
            $start_date_dt = new DateTime(get_sub_field('start_date', $resident_id));
            $start_date = $start_date_dt->format('M j, Y');
            $end_date_dt = new DateTime(get_sub_field('end_date', $resident_id));
            $end_date = $end_date_dt->format('M j, Y');
            $start_year = $start_date_dt->format('Y');
            $end_year = $end_date_dt->format('Y');
        }
    }
} else {
    $no_link = 'nolink';
    $end_date_dt = new DateTime(get_resident_end_date($resident_id));
    $end_year = $end_date_dt->format('Y');
}
示例#2
0
if (is_current($resident_id) && sizeof($residencies) > 1) {
    echo '<div class="residencies list">';
    echo '<h3 class="title">Past Residencies</h3>';
    foreach ($residencies as $i => $residency) {
        if ($i == 0 && is_current($resident_id)) {
            continue;
        }
        $start_year = $residency->start_date_dt->format('Y');
        $end_year = $residency->end_date_dt->format('Y');
        echo '<div class="residency">';
        echo $start_year;
        if ($start_year != $end_year) {
            echo '&ndash;' . $end_year;
        }
        echo '</br>';
        echo get_sponsors($resident_id, $i);
        echo '</div>';
    }
    echo '</div>';
}
if ($events) {
    echo '<div class="events list">';
    echo '<h3 class="title">Events &amp; Exhibitions</h3>';
    foreach ($events as $event) {
        $event_id = $event->ID;
        $event_name = get_the_title($event_id);
        $event_url = get_the_permalink($event_id);
        $event_status = get_event_status($event_id);
        echo '<a class="' . $event_status . ' event" href="' . $event_url . '">';
        echo '<div class="name">' . $event_name . '</div>';
        echo '<div class="date">' . get_event_date($event_id) . '</div>';
示例#3
0
if (have_posts()) {
    while (have_posts()) {
        the_post();
        global $post;
        $id = $post->ID;
        $name = $post->post_title;
        $url = get_permalink($id);
        $end_date = new DateTime(get_resident_end_date($id));
        $year = $end_date->format('Y');
        $year_url = $residents_url . '?filter=all&date=' . $year;
        $year = '<a href="' . $year_url . '">' . $year . '</a>';
        $bio = get_field('bio', $resident_id);
        echo '<div class="row shelf-item resident">';
        echo '<div class="inner">';
        echo '<div class="value name">';
        if ($bio) {
            echo '<a href="' . $url . '">';
            echo $name;
            echo '</a>';
        } else {
            echo $name;
        }
        echo '</div>';
        echo '<div class="value years">' . $year . '</div>';
        echo '<div class="value sponsors">' . get_sponsors($id) . '</div>';
        echo '</div>';
        echo '</div>';
        echo $sponsors;
    }
}
wp_reset_query();