<?php
get_header();
?>
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <div class="wrap-content-area">
                <div id="primary" class="content-area">
                    <main id="main" class="main-content" role="main">
                        <div class="entry-content">
                            <?php while (have_posts()) : the_post(); ?>

                            
                                <?php
                                $address = get_post_meta(get_the_ID(), '_address_event', true);
                                $date = get_post_meta(get_the_ID(), '_date_event', true);
                                $time = get_post_meta(get_the_ID(), '_time_event', true);
                                $price = get_post_meta(get_the_ID(), '_ticket_price', true);
                                $link = get_post_meta($post->ID,'_link_event', true);
                                ?>
                                <div class="event-detail-box">
                                    <h2 class="event-detail-heading">
                                        <?php esc_html_e('Running Events Coming Up include', 'themesflat-core'); ?>

                                    </h2>
                                    <div class="detail-box-content">
                                        <a href="<?php echo esc_url($link); ?>">
                                            <img src="<?php echo esc_attr(get_the_post_thumbnail_url(get_the_ID()));  ?>" alt="">
                                        </a>
                                        <div class="event-detail-card">
                                            <div class="event-detail-container">
                                                <h4 class="event-detail-heading"><?php esc_html_e('Ticket', 'themesflat-core'); ?></h4>
                                                <p class="price">
                                                    <span><?php esc_html_e($price, 'themesflat-core'); ?></span>
                                                    <span class="ticket-price"><?php esc_html_e('/ticket', 'themesflat-core'); ?></span>
                                                </p>

                                                <p class="event-title"><?php esc_html_e(the_title(), 'themesflat-core'); ?></p>
                                                <div class="event-date-time-or-location-container">
                                                    <?php if (!empty($date)) : ?>
                                                        <div class="event-date-time-container">
                                                            <i class="icon-calendar-blank"></i>
                                                            <p><?php esc_html_e($date, 'themesflat-core'); ?></p>
                                                        </div>
                                                    <?php endif; ?>
                                                    <?php if (!empty($time)) : ?>
                                                        <div class="event-date-time-container">
                                                            <i class="icon-timer"></i>
                                                            <p><?php esc_html_e($time, 'themesflat-core'); ?></p>
                                                        </div>
                                                    <?php endif; ?>
                                                    <?php if (!empty($address)) : ?>
                                                        <div class="event-date-time-container">
                                                            <i class="icon-map-pin"></i>
                                                            <p><?php esc_html_e($address, 'themesflat-core'); ?></p> 
                                                        </div>
                                                    <?php endif; ?>
                                                </div>
                                                <div class="btn-learn-more">
                                                    <a href="<?php echo esc_url($link); ?>" class="learn-more-btn"><?php esc_html_e('Join now', 'themesflat-core'); ?></a>
                                                </div>

                                            </div>                                            

                                        </div>
                                    </div>
                                </div>
                                <?php if (themesflat_get_opt_elementor('show_sv_thumb') == 1) : ?>
                                    <div class="featured-post"><?php the_post_thumbnail('themesflat-service-single'); ?></div>
                                <?php endif; ?>
                                <?php if (themesflat_get_opt('services_featured_title') != '') : ?>
                                    <h1 class="post-title"><?php the_title(); ?></h1>
                                <?php endif; ?>

                                <?php the_content(); ?>
                                <?php if (themesflat_get_opt('services_show_post_navigator') == 1) : ?>
                                    <!-- Navigation  -->
                                    <?php themesflat_post_navigation(); ?>

                                <?php endif; ?>
                            <?php endwhile; // end of the loop. 
                            ?>
                        </div><!-- ./entry-content -->
                    </main><!-- #main -->
                </div><!-- #primary -->
                <?php
                if (themesflat_get_opt('services_layout') == 'sidebar-left' || themesflat_get_opt('services_layout') == 'sidebar-right') :
                    get_sidebar();
                endif;
                ?>
            </div>
        </div>
    </div>
</div>
<?php get_footer(); ?>