<?php
/**
 * 
 * Template Name: promociones
 * 
 */
?>
<?php get_header(); ?>
	<?php if (get_locale() == 'es_PE') {?>
		<section id="destinos" class="contenedor-tg">
			<div class="titulo-tg">
				<div class="container">
					<div class="row">
						<div class="col-md-12 col-sm-12 col-xs-12">
							<h1>Promociones</h1>
						</div>
					</div>
				</div>
			</div>
			<div class="container">
				<div class="row">
			<?php
			$args = array(
			    'post_type' => 'promocion',
			    'posts_per_page' => '-1'
			);
			?>
			<?php $the_query = new WP_Query($args); ?>
			<?php if ($the_query->have_posts()) : ?>
			    <?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
					<div class="col-md-6 col-sm-12 col-xs-12">
						<a href="<?php the_permalink() ?>">
							<div class="proms-item">
								<figure>
									<?php $prom_img1= get_field('prom-img1'); ?>
									<img src="<?php echo $prom_img1['url']; ?>" alt="<?php echo $prom_img1['title']; ?>" title="<?php echo $prom_img1['title']; ?>">
								</figure>
								<div class="proms-txto">
									<div class="promstitulo">
										<?php the_field('prom-titulo') ?>
									</div>
									<?php the_field('prom-parrafo') ?>
									<a href="<?php the_permalink() ?>">
										<button class="but but-verde">
											<span class="tg-plus"></span>Ver más
										</button>
									</a>
									<button class="but but-azul">
										<span class="tg-cart"></span>Agregar
									</button>
								</div>
							</div>
						</a>
					</div>
			    <?php endwhile; ?>
			    <?php wp_reset_postdata(); ?>
			<?php endif; ?>

				</div>
			</div>
		</section>

	<?php }else{ ?>

		<section id="destinos" class="contenedor-tg">
			<div class="titulo-tg">
				<div class="container">
					<div class="row">
						<div class="col-md-12 col-sm-12 col-xs-12">
							<h1>Promotions</h1>
						</div>
					</div>
				</div>
			</div>
			<div class="container">
				<div class="row">
			<?php
			$args = array(
			    'post_type' => 'promocion',
			    'posts_per_page' => '-1'
			);
			?>
			<?php $the_query = new WP_Query($args); ?>
			<?php if ($the_query->have_posts()) : ?>
			    <?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
					<div class="col-md-4 col-sm-4 col-xs-12">
						<a href="<?php the_permalink() ?>">
							<div class="proms-item">
								<figure>
									<?php $prom_img1= get_field('prom-img1'); ?>
									<img src="<?php echo $prom_img1['url']; ?>" alt="<?php echo $prom_img1['title']; ?>" title="<?php echo $prom_img1['title']; ?>">
								</figure>
								<div class="proms-txto">
									<div class="promstitulo">
										<?php the_field('prom-titulo') ?>
									</div>
									<?php the_field('prom-parrafo') ?>
									<a href="<?php the_permalink() ?>">
										<button class="but but-verde">
											<span class="tg-plus"></span>Ver más
										</button>
									</a>
									<button class="but but-azul">
										<span class="tg-cart"></span>Agregar
									</button>
								</div>
							</div>
						</a>
					</div>
			    <?php endwhile; ?>
			    <?php wp_reset_postdata(); ?>
			<?php endif; ?>

				</div>
			</div>
		</section>
	<?php } ?>
<?php get_footer() ?>