<?php /* Template Name: refit */ ?>

<?php get_header();?>



<div class="mainsingle-pages">
    <div class="container">
        <div class="row">
            <?php if (has_post_thumbnail()) { ?>
                <div class="col-lg-12 d-flex justify-content-center mb-5 wow fadeInUp">
                    <div class="singimg">
                        <?php
                        $thumbnail_id = get_post_thumbnail_id();
                        $title = get_the_title($thumbnail_id);
                        $alt = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true) ?: $title ;
                        ?>
                        <img src="<?php echo get_the_post_thumbnail_url(null, 'full'); ?>"
                             class="img-fluid"
                             alt="<?php echo esc_attr($alt); ?>"
                             title="<?php echo esc_attr($title); ?>" />
                    </div>
                </div>
            <?php } ?>
            <?php if(have_posts()) :  while(have_posts()) : the_post(); ?>
                <div class="col-lg-12 d-flex justify-content-center wow fadeInUp">
                    <div class="singcont">
                        <?php the_content(); ?>
                    </div>
                </div>
            <?php endwhile;  else :  endif;   ?>
            
<div class="col-md-12 mt-5 mb-5">
     <a class="main-buttonsc wow <?php echo ( qtranxf_getLanguage() == 'ar' ) ? 'fadeInUp' : 'fadeInUp'; ?>"
                   href="<?php echo esc_url( get_page_link( 1265 ) ); ?>" data-wow-delay= '.4s' >
                                <span>
                                    <?php
                                        _e("<!--:en--> Contact Us <!--:--><!--:ar-->  تواصل معنا  <!--:-->");
                                    ?>
                                </span>
                    <div class="iconbtnmain">
                        <i class="fa-solid fa-arrow-up"></i>
                    </div>
                </a>
</div>
            
        </div>
        
        
<?php
$images = get_field('the_imagescustombuildrefit'); // تأكد من الاسم الصحيح للحقل
$size = 'full';

if( $images ): ?>
    <div class="row mt-5">
        <?php $mage_u=.1; foreach( $images as $image ): 
            $id = is_array($image) ? $image['ID'] : $image; 
           $full_image_url = wp_get_attachment_image_url($id, 'full'); // رابط 
        ?>
        
            <div class="col-md-3 col-6 mb-3 wow fadeInUp" data-wow-delay= '<?php echo $mage_u ?>s'>
                <div class="imggally">
                    <a data-fancybox="gallery" href="<?php echo esc_url($full_image_url); ?>"  >
                        <?php echo wp_get_attachment_image( $id, $size ); ?>
                    </a>
                </div>
            </div>
        <?php $mage_u+=.1; endforeach; ?>
    </div>
<?php endif; ?>

        
        
        
    </div>
</div>



<?php get_footer();?>