%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/cwg/wp-content/themes/cwg/template-parts/events/
Upload File :
Create Path :
Current File : //var/www/cwg/wp-content/themes/cwg/template-parts/events/event-item.php

<?php
    $location = get_the_terms($event->ID, get_taxonomy_name(get_post_type($event->ID)));
    if(is_array($location) && $location[0]){
        $location = $location[0]->name;
    }
    // var_dump($event->ID);
    $start_date = DateTime::createFromFormat('d/m/Y', get_field('start_date',$event->ID));
    $end_date = DateTime::createFromFormat('d/m/Y', get_field('end_date',$event->ID));

    if($event->post_type == 'exhibitions') {
        $title = get_field('multiple_artist_title', $event->ID) ? get_field('multiple_artist_title', $event->ID) : (get_field('artist', $event->ID) && get_field('artist', $event->ID)[0] ? get_field('artist', $event->ID)[0]->post_title : '');
        $subtitle = $event->post_title;
    } else {
        $title = $event->post_title;
        $subtitle = get_field('booth', $event->ID);
    }

    $final_location = ($location ? $location : get_city_name(get_field('location', $event->ID)));
    $date = '';
    $dateOverride = get_field('date_override', $event->ID);
    if($dateOverride) {
        $date = $dateOverride;
    } else {
        if($start_date && $end_date) {
            $date = DateTime::createFromFormat('d/m/Y', get_field('start_date',$event->ID))->format('dS M') . ' - ' . DateTime::createFromFormat('d/m/Y', get_field('end_date',$event->ID))->format('dS M Y');
        } else if($start_date) {
            $date = DateTime::createFromFormat('d/m/Y', get_field('start_date',$event->ID))->format('dS M');
        }
    }

?>

<a href="<?php the_permalink($event->ID); ?>" class="relative <?= isset($mobile_class) ? $mobile_class : ''; ?> <?= isset($desktop_class) ? $desktop_class : ''; ?> <?= isset($mobile_class_artist) ? $mobile_class_artist : ''; ?>">
    <div class="mt-[100%]"></div>
    <div class="absolute h-full w-full top-0 left-0">
        <?= wp_get_attachment_image(get_field('square_listing_image', $event->ID), 'full', false, array('class' => 'w-full h-full object-cover absolute top-0')); ?>

        <div class="absolute bottom-0 bg-gradient-product w-full h-full">
        </div>

        <div class="absolute top-0 left-0 w-full inline">
            <p class="text-white text-[11px] md:text-[9.2px] md:leading-[13.4px] px-5 pt-5 font-light leading-4 uppercase hide-inside-balise">
                <?= $final_location ?>
                <?= $final_location && $date ? ' | ' : '' ?>
                <?= $date ?>
            </p>
        </div>

        <div class="text-white w-full inline absolute bottom-0 px-5 pb-[10px] uppercase">
            <div class="w-full border-solid border-t border-white mb-[10px]"></div>
            <h2 class="whitespace-nowrap overflow-ellipsis overflow-hidden font-medium text-xs text-[11px] leading-tight md:text-[9.2px] md:leading-[13.4px]">
                <?= $title ?>&nbsp;
            </h2>
            <h3 class="whitespace-nowrap overflow-ellipsis overflow-hidden font-light text-xs text-[11px] leading-tight md:text-[9.2px] md:leading-[13.4px]">
                <?= $subtitle ?>&nbsp;
            </h3>
        </div>
    </div>
</a>

Zerion Mini Shell 1.0