<?php
/**
 * 
 * Template Name: galeria
 * 
 */
?>
<?php get_header(); ?>
	<section id="galeria" class="contenedor-tg">
		<div class="titulo-tg">
			<div class="container">
				<div class="row">
					<div class="col-md-12 col-sm-12 col-xs-12">
						<?php if (get_locale() == 'es_PE') {?>
							<h1>Galeria</h1>
						<?php }else{ ?>
							<h1>Gallery</h1>
						<?php } ?>
					</div>
				</div>
			</div>
		</div>
		<div class="container">
			<div class="row">
			<?php
			$args = array(
			    'post_type' => 'galeria',
				'posts_per_page' => '-1',
		        'orderby' => 'rand'
			);
			?>
		    <?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">
						<?php $galeria_img= get_field('galeria-img'); ?>
						<a href="<?php echo $galeria_img['url']; ?>" class="grouped_elements" rel="group1">
							<div class="galeria-item">
								<figure>
									
									<img src="<?php echo $galeria_img['url']; ?>" alt="<?php echo $galeria_img['title']; ?>" title="<?php echo $galeria_img['title']; ?>">
								</figure>
								<div class="galeria-titulo">
									<h2><?php the_field('galeria-titulo') ?></h2>
								</div>
								<div class="galeria-hover">
									<button class="but-2">
										<span class="tg-zoom-in"></span>
									</button>
								</div>
							</div>
						</a>
						</a>
					</div>
				<?php endwhile; ?>
			<?php endif; ?>
			<?php wp_reset_postdata(); ?>
			</div>
		</div>
	</section>
<?php get_footer() ?>