<?php
/**
 * Template Name: Télechargement
 *
 */
$ext_ref = externe_referrer();
if($ext_ref) {
    get_header();
}
$post_ID = 260;
?>

<div id="download" class="clearfix container ">
    <div class="phototheque-content">

        <div class="nav-phototeque container gray-bg row fixed">

            <div class="header">
                <div class = "btn-wrapper row close-panel">
                    <div class="pink-btn circle-btn"><span class = "abs-center backlink">Retour</span></div>
                </div>
                <nav class = "row">
                    <h2 class = "crete big-title">Téléchargement</h2>
                </nav>  
            </div>
        </div>
        <div class="gallery-wrapper right hidden-elem row">
            <div class="panel panel-content product-list transition clearfix list-animation">
                <?php
                if (get_field('telechargement', $post_ID)):
                    $i = 0;
                    while (has_sub_field('telechargement', $post_ID)) :
                        ?>
                        <section id = "cat<?php echo $i; ?>">
                            <h2 class="crete small-title"><?php the_sub_field('tl_titre', $post_ID); ?></h2>
                            <div class="product-list">
                                <?php
                                if (get_sub_field('tl_images', $post_ID)):

                                    while (has_sub_field('tl_images', $post_ID)) :
                                        $options = array();
                                        $options['image'] = get_sub_field('tl_image');
                                        $options['title'] = get_sub_field('tl_titre_image');
                                        $options['dwnldLink'] = get_sub_field('tl_link');
                                        echo nap_get_item($post_ID, null, '', $options);
                                        ?>

                                        <?php
                                    endwhile;
                                endif;
                                ?>
                            </div>
                        </section>

                        <?php
                        $i++;
                    endwhile;
                endif;
                ?>

            </div>
        </div>
    </div>
</div>
<?php
 if($ext_ref) {
    get_footer();
 }
 ?>