<?php get_header();?>


		<!-- section -->
		<section>

		<?php if (have_posts()): while (have_posts()): the_post();?>


		<article id="post-<?php the_ID();?>" <?php post_class();?>>

			<!-- post thumbnail -->
			<?php if (has_post_thumbnail()): // Check if thumbnail exists ?>
				<a class="thumbnailwrapper" href="<?php the_permalink();?>" title="<?php the_title();?>">
					<?php the_post_thumbnail('home-event-thumbnail');?>
				</a>
			<?php endif;?>
			<!-- /post thumbnail -->

			<div class="event-metadata">
				<?php
					$event_datum = get_post_meta( get_the_ID(), 'dis-esemeny-datum', true );
					$event_link = get_post_meta( get_the_ID(), 'dis-esemeny-link', true );	
				?>

				<div class="top-row">
					<div class="ev-date">
						<?php
							echo preg_replace('/^(\d{4}\.)(\d{2}\.)(\d{2}\.)$/','\1</br>\2 \3',$event_datum );
							// echo $event_datum;
						?>
					</div>

						<!-- Arrow -->
						<a href="<?php echo $event_link; ?>" target="_blank" class="arrow-link">
							→
						</a>

					</div>
				<div class="hr">
				
				</div>
				<div class="bottom-row">
					<!-- title -->
					<h2>
						<?php the_title();?>
					</h2>
					<div class="vr"></div>
					<!-- Tovább button -->
					<a href="<?php echo $event_link; ?>" class="text-link" target="_blank">Tovább az eseményre</a>
				</div>
	
			</div><!-- end event-metadata -->
			

			

			


			<!-- post title -->
			
			<!-- /post title -->



		</article>


		<?php endwhile;?>

	<?php else: ?>

<!-- article -->
<article>
	<h2><?php _e('Sorry, nothing to display.', 'dis2019');?></h2>
</article>
<!-- /article -->

<?php endif;?>

			

		</section>
		<!-- /section -->




<?php get_footer();?>