File: /datos/www/www.colombia.co/public_html/wp-content/themes/colombia2016-old/page.php
<?php
get_header();
while ( have_posts() ) : the_post();
$subtitle = get_post_meta(get_the_ID(), 'subtitle', true);
?>
<main role="main" class="l-flex">
<div id="category-header">
<div class="l-container l-flex">
<div class="cat-header-container">
<?php
if($subtitle){
?>
<h2 class="cat-name"><?php the_title(); ?></h2>
<h1 class="cat-title"><?php echo $subtitle; ?></h1>
<?php
}
else{
?>
<h1 class="cat-title"><?php the_title(); ?></h1>
<?php } ?>
</div>
</div>
</div>
<div id="content-wrapper" class="l-container l-flex">
<?php
$gallery = get_field('gallery_post');
$n = count($gallery);
if($gallery){
if($n > 1){
?>
<div id="post-slider" class="swiper-container">
<div class="swiper-wrapper">
<?php
foreach($gallery as $img){
$url = $img["image_gallery_post"]['url'];
$alt = $img["image_gallery_post"]['alt'];
$title = $img["image_gallery_post"]['title'];
?>
<div class="swiper-slide">
<figure class="slide">
<img class="slide-img" src="<?php echo $url; ?>" alt="<?php echo $alt; ?>" title="<?php echo $title; ?>" />
</figure>
</div>
<?php
}
?>
</div>
<div class="swiper-pagination"></div>
</div>
<?php if(get_field('image_credit')): ?>
<div class="img-credits"><?php the_field('image_credit') ?></div>
<?php endif; ?>
<?php
}
else{
$url = $gallery[0]["image_gallery_post"]['url'];
$alt = $gallery[0]["image_gallery_post"]['alt'];
$title = $gallery[0]["image_gallery_post"]['title'];
?>
<figure class="post-img">
<img class="slide-img" src="<?php echo $url; ?>" alt="<?php echo $alt; ?>" title="<?php echo $title; ?>" />
<?php if(get_field('image_credit')): ?>
<figcaption class="img-credits"><?php the_field('image_credit') ?></figcaption>
<?php endif; ?>
</figure>
<?php
}
}
elseif(has_post_thumbnail()){
if(has_post_video()){
?>
<figure class="post-img">
<?php the_post_thumbnail(); ?>
<?php if(get_field('image_credit')): ?>
<figcaption class="img-credits"><?php the_field('image_credit') ?></figcaption>
<?php endif; ?>
</figure>
<?php
}
else{
$image = wp_get_attachment_image_src(get_post_thumbnail_id($post->id), 'post-thumbnail');
if(($image[1] > 600) && ($image[1] > $image[2])):
?>
<figure class="post-img">
<?php the_post_thumbnail(); ?>
<?php if(get_field('image_credit')): ?>
<figcaption class="img-credits"><?php the_field('image_credit') ?></figcaption>
<?php endif; ?>
</figure>
<?php
endif;
}
}
?>
<section id="post-content">
<article <?php post_class('l-flex'); ?> id="post-<?php the_ID(); ?>">
<div class="post-content">
<?php the_content(); ?>
</div>
<div class="post-tags">
<?php the_tags('', ''); ?>
</div>
</article>
</section>
<?php get_sidebar(); ?>
</div>
</main>
<?php endwhile; ?>
<?php get_footer(); ?>