<?php
   /**
    * This file is responsible for the works section on front page.
    * @version:1.0
    */
   ?> 
<?php if ( true == get_theme_mod( 'workonoff', true ) ) : ?>
<!--#Our Featured Works Area start-->
<section  id="works"  class="featured_works row" data-stellar-background-ratio="0.3">
   <div class="title wow fadeInUp pt_40">
      <h2><?php _e( get_theme_mod('homepage_featured_title', __('Our Featured Work' , 'plumbing-lite'))); ?></h2>
   </div>
   <div class="featured_gallery">
      <?php
         $my_theme_slide_option_value = get_theme_mod( 'homepage_work_');
          if(isset($my_theme_slide_option_value) && !empty($my_theme_slide_option_value)){
            $i = 1;
         foreach ( $my_theme_slide_option_value as $item ) : 

            $i++;

        

          ?>

      <?php if ( ! wp_attachment_is_image( $item['work_image'] ) ){
         $img_ur = esc_url_raw($item['work_image']);
         
         } else {
         $img_ur = wp_get_attachment_url($item['work_image']);
         } ?>
      <div class="col-md-4 col-sm-4 col-xs-12 gallery_iner p0">
         <img src="<?php echo esc_url( $img_ur); ?>" alt="<?php esc_attr_e($item['work_field'],'plumbing-lite'); ?>">
         <div class="gallery_hover">
            <h4><?php echo ($item['work_field']); ?></h4>

            
            <a href="" data-toggle="modal" data-target="#myModal<?php echo $i; ?>"><?php echo ($item['work_button']); ?></a>
         </div>
      </div>

            <!-- Modal -->


      <?php endforeach; ?>
       <?php }?>

   </div>
</section>

<?php
   $my_theme_popup_option = get_theme_mod( 'homepage_work_Module');
    if(isset($my_theme_popup_option) && !empty($my_theme_popup_option)){

     $i = 1; 
   foreach ( $my_theme_popup_option as $item ) : 
    $i++;

   ?>
  

<div id="myModal<?php echo $i; ?>" class="modal fade" role="dialog">
  <div class="modal-dialog">
    <!-- Modal content-->
    <div class="modal-content" >
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title"><?php echo $item['module_name']; ?></h4>
      </div>
      <div class="modal-body">
        <p><?php echo $item['module_text']; ?></p>
      </div>
      <?php if(!empty($item['close_button'])){ ?>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $item['close_button']; ?></button>
      </div>
    <?php } ?>
    </div>

  </div>
</div>
</div>
</div>

<?php
  
  endforeach;

}

?>
<!--#End Our Featured Works Area -->
<?php endif; ?>

