<?php
global $qode_options_elision;
?>
<article style="background-color: <?= $qode_options_elision['background_color'] ?>"
         id="<?= (get_post_type() == 'exhibitors' || get_post_type() == 'partners') ? substr(get_post_type(), 0, -1) : get_post_type() ?>-<?php the_ID(); ?>" <?php post_class(); ?>>
    <?php if (get_post_type() !== 'exhibitors' && has_post_thumbnail()) { ?>
        <div class="post_image">
            <a href="<?php the_permalink(); ?>" target="_self" title="<?php the_title_attribute(); ?>">
                <?php the_post_thumbnail('post-thumbnail', 'class=thumbnail-grid'); ?>
            </a>
        </div>
    <?php } elseif (get_post_type() == 'exhibitors') {
        ?>
        <div class="exhibitor-preview-glide">
            <?php
            $galleryData = get_post_meta(get_the_ID(), 'gallery_data', true);
            if (!empty($galleryData) && array_key_exists('image_id', $galleryData)) {
                ?>
                <div class="img_slides">
                    <?php

                    if (class_exists('MultiPostThumbnails')) {
                        if (MultiPostThumbnails::has_post_thumbnail(get_post_type(), 'overview-thumbnail')) { ?>
                            <div class="img_slide">
                                <a href="<?php the_permalink(); ?>"><img class=""
                                                                         src="<?= MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'overview-thumbnail', get_the_ID()) ?>"></a>
                            </div>
                            <?php
                        }
                    }
                    foreach ($galleryData['image_id'] as $id) {
                        ?>
                        <div class="img_slide">
                            <a href="<?php the_permalink(); ?>"><img class="" src="<?= \Eventman\interevent_get_attachment_url($id, 'large') ?>"></a>
                        </div>
                    <?php } ?>
                </div>
            <?php } else { ?>
                <div class="no_images">
                    <div class="img_slide">
                        <span><?= _x("No Images", 'ms-eventman') ?></span>
                    </div>
                </div>
            <?php } ?>
        </div>
    <?php } ?>
    <div class="post_text">
        <h3 class="post_title_label"><a href="<?php the_permalink(); ?>" target="_self"
                                        title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
        <div><small><?php $get_post_meta = get_post_meta(get_the_ID(), 'custom_post_fields', true);
                echo isset($get_post_meta['city']) ? $get_post_meta['city'] : '' ?>&nbsp;</small></div>

        <div class="post_additional_info">
            <span class="post_social">
                <?php echo do_shortcode('[social_share]'); ?>
            </span>
        </div>
    </div>
</article>
