<?php get_header(); 
$gallery = get_field('gallery');

?>
<section class="section about">
    <div class="container">
        <div class="services-row">
            <div class="breadcrumbs">
                <?php if(function_exists('bcn_display')) { bcn_display(); }?>
            </div>
            <?php if (have_posts()) { while (have_posts()) { the_post();  
            if ( has_post_thumbnail() ) { 
                        $url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'post');
                        $thmb = $url[0];
                          } else {
                            $thmb = TEMPLATE_DIR . "/img/main/placeholder.webp";
                      } ?>
                <div class="about-body">
                        <div class="about-top">
                            <h1 class="about__title">
                                <?php echo get_field('alt_tit') ? get_field('alt_tit') : the_title()?>   
                            </h1>
                            <div class="application-top__text">
                                <?php echo get_field('alt_desc') ? get_field('alt_desc') : '';?>   
                            </div>
                        </div>
                        <div class="about-content">
                            <?php if ($url) { ?>
                                <div class="about-left" data-aos="fade-right" data-aos-duration="1200">
                                    <img class="page-thumb" src="<?php echo $thmb; ?>" alt="<?php the_title();?>">
                                </div>
                            <?php } ?>
                            <div class="about-right">
                                <div class="about__text">
                                    <?php the_content()?>
                                </div>
                            </div>
                        </div>
   
            </div>


        </div>
    </div>
</section>
<?php if ($gallery) {?>      
<section class="section certificates">
            <div class="container">
                <div class="certificates-row">
                    <div class="certificates-top">
                        <h2 class="certificates-top__title">
                        <?php echo get_field('gal_tit') ? get_field('gal_tit') : 'Галерея';?>
                        </h2>
                        <div class="certificates-top__text">
                            <?php echo get_field('gal_desc') ? get_field('gal_desc') : '';?>
                        </div>
                    </div>
                    <div class="certificates-slider slider-container">
                        <div class="swiper-wrapper">
                            <?php foreach ($gallery as $g) { 
                                $img = $g['url'];
                                $gthumb = $g['sizes']['medium_large']; ?>
                            <div class="certificates-block swiper-slide">
                            <a data-glightbox="images-gallery" class="glightbox" href="<?php echo $img; ?>" class="">
                                <img src="<?php echo $gthumb; ?>" alt=" <?php echo get_field('gal_tit') ? get_field('gal_tit') : 'Галерея';?>">
                            </a>

                            </div>
                            <?php  } ?>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <?php } ?>
<?php include_once('tpl-footerform.php'); ?>
<?php }} ?>

<?php get_footer(); ?>