<?php get_header();?>



 <!-- Start Banner 
    ============================================= -->
	
	<?php
	function getid($url)
	{
	     // YouTube URL
				$youtubeUrl = 'https://www.youtube.com/watch?v=VIDEO_ID';
				$youtubeUrl=$url;
				// Parse the URL
				$urlParts = parse_url($youtubeUrl);
				
				if (isset($urlParts['query'])) {
					// Parse the query string
					parse_str($urlParts['query'], $queryParameters);
				
					if (isset($queryParameters['v'])) {
						$videoId = $queryParameters['v'];
						return $videoId;
					} else {
						return '';
					}
				} else {
					return '';
				}
	}
	$arg_banner=array(
	              'post_type'=>'home',
				  'post_status'=>'publish',
	           );
	$all_banner = new WP_Query($arg_banner);
	if($all_banner->have_posts()):		   
	while($all_banner->have_posts()): $all_banner -> the_post(); 
	$banners=get_field('banners'); 
	$banner_bg=get_field('backgroung_image');
	$banner_video=get_field('background_video');
	$video_id=getid($banner_video);
	?>
    <div class="banner-area inc-video video-bg-live bg-cover" style="background-image: url(<?php echo $banner_bg['sizes']['bannerbg-thumb size'];?>);">
       
	   <?php if($video_id):?> <div class="player" data-property="{videoURL:'<?php echo $video_id;?>',containment:'.video-bg-live', showControls:false, autoPlay:true, zoom:0, loop:true, mute:true, startAt:3, opacity:1, quality:'default'}"></div><?php endif;?>
		
        
        <div id="bootcarousel" class="carousel text-light slide animate_text" data-ride="carousel">

            <!-- Indicators for slides -->
            <div class="carousel-indicator">
                <div class="container">
                    <div class="row">
                        <div class="col-lg-12">
                            <ol class="carousel-indicators right">
                                <li data-target="#bootcarousel" data-slide-to="0" class="active"></li>
                                <li data-target="#bootcarousel" data-slide-to="1"></li>
                            </ol>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Wrapper for slides -->
            <div class="carousel-inner">
			<?php
			
			if($banners):$i=1;foreach($banners as $banner){?>
                <div class="carousel-item <?php if($i==1):?>active<?php endif;?>">
                    <div class="box-table shadow dark">
                        <div class="box-cell">
                            <div class="container">
                                <div class="row">
                                    <div class="col-lg-8 offset-lg-4">
                                        <div class="content">
                                            <h4 data-animation="animated zoomInRight"><?php echo $banner['title'];?></h4>
                                            <h2 data-animation="animated slideInRight"><?php echo $banner['content'];?></span></h2>
											<?php if($banner['button_text']):?>
                                            <a data-animation="animated zoomInUp" class="btn btn-theme effect btn-md" href="<?php echo $banner['button_link'];?>"><?php echo $banner['button_text'];?></a>
											<?php endif;?>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
              <?php $i++;} endif;?>
                

                

                
            </div>
            <!-- End Wrapper for slides -->

        </div>
    </div>
	
	<?php endwhile;endif;?>
    <!-- End Banner -->

    <!-- Start About Area
    ============================================= -->
    <div class="about-content-area default-padding">
        <div class="container">
            <div class="content-box">
                <div class="row">
                    <div class="col-lg-6 thumb">
                        <div class="thumb-box">
                            <img src="<?php echo get_template_directory_uri();?>/assets/img/800x900.png" alt="Thumb">
                            <img src="<?php echo get_template_directory_uri();?>/assets/img/800x800.png" alt="Thumb">
                            <div class="shape" style="background-image: url(assets/img/shape/1.png);"></div>
                        </div>
                    </div>
                    <div class="col-lg-6 info">
                        <h2>We Combine Technology <br> with Business Ideas</h2>
                        <ul>
                            <li>
                                <div class="icon">
                                    <i class="ti-bookmark-alt"></i>
                                </div>
                                <div class="info">
                                    <h4>Certified Company</h4>
                                    <p>
                                        Common so wicket appear to sudden worthy on. Shade of offer ye whole stood hoped. 
                                    </p>
                                </div>
                            </li>
                            <li>
                                <div class="icon">
                                    <i class="ti-id-badge"></i>
                                </div>
                                <div class="info">
                                    <h4>Experience Employee</h4>
                                    <p>
                                        Common so wicket appear to sudden worthy on. Shade of offer ye whole stood hoped. 
                                    </p>
                                </div>
                            </li>
                        </ul>
                        <div class="call">
                            <div class="icon">
                                <i class="flaticon-telephone"></i>
                            </div>
                            <div class="intro">
                                <h5>+123 456 7890</h5>
                                <span>Call to ask any question</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-4 center-info">
                        
                    </div>
                    
                </div>
            </div>
        </div>
    </div>
    <!-- End About -->
    <?php $arg_service=array(
		                          "post_type"=>'service',
								  "post_status"=>'publish',
								  "post_per_page"=>'3',
								  
		                       );
		     $all_service = new WP_Query($arg_service);
			 if($all_service->have_posts()):
			  $arg_service_section=array(
		                          "post_type"=>'service-section',
								  "post_status"=>'publish',
								  
								  
		                       );
		     $all_service_section = new WP_Query($arg_service_section);
			 
			  
	?>
    <!-- Star Services Area
    ============================================= -->
    <div class="bg-gray thumb-services-area inc-thumbnail default-padding bottom-less">
        <!-- Shape -->
        <div class="right-shape">
            <img src="<?php echo get_template_directory_uri();?>/assets/img/shape/9.png" alt="Shape">
        </div>
        <!-- Shape -->
        <div class="container">
		
		 <?php if($all_service_section->have_posts()): while($all_service_section->have_posts()):$all_service_section -> the_post(); 
		  $service_section_title=get_the_title();
		  $service_section_tagline=get_field('tagline');
		  
		  ?>    
            <div class="row">
                <div class="col-lg-8 offset-lg-2">
                    <div class="site-heading text-center">
                        <h4><?php echo $service_section_title;?></h4>
                        <h2><?php echo $service_section_tagline;?></h2>
                        <div class="devider"></div>
                    </div>
                </div>
            </div>
			<?php endwhile; endif;?>
			
        </div>
        <div class="container">
            <div class="services-items text-center">
                <div class="row">
				
				<?php while($all_service->have_posts()): $all_service -> the_post();
			  $service_title=get_the_title();
			  $service_icon=get_field('icon');
			  $service_brief=get_field('brief');
			  $service_content=get_the_content();
			  $thumb_id = get_post_thumbnail_id();
              $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'servicesmall-thumb', true);
              $thumb_url = $thumb_url_array[0];
			   ?>
                    <!-- Single Item -->
                    <div class="col-lg-4 col-md-6 single-item">
                        <div class="item" style="background-image: url(<?php echo $thumb_url;?>);">
                            <div class="info">
                                <i class="flaticon-<?php echo $service_icon;?>"></i>
                                <h4><?php echo $service_title;?></h4>
                                <p>
                                    <?php echo $service_brief;?>
                                </p>
                                <div class="bottom">
                                    <a href="<?php the_permalink();?>"><i class="fas fa-arrow-right"></i> Read More</a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- End Single Item -->
                 <?php endwhile;?>   
                </div>
                <div class="text-center mt-4">
                    <div class="button">
                        <a class="btn btn-gradient effect btn-md" href="<?php echo site_url('service');?>">SEE MORE</a>
                    </div>
                </div>
				
				
            </div>
        </div>
    </div>
    <!-- End Services Area -->
	
	<?php endif;?>


    <?php $arg_gal=array(
		                          "post_type"=>'gallery',
								  "post_status"=>'publish',
								   "post_per_page"=>'6',
								  
								  
		                       );
		     $all_gal = new WP_Query($arg_gal);
			 if($all_gal->have_posts()):
			  $arg_gal_section=array(
		                          "post_type"=>'gallery_section',
								  "post_status"=>'publish',
								 
								  
		                       );
		     $all_gal_section = new WP_Query($arg_gal_section);
			 
			  
	?>

    <!-- Start Gallery Area
    ============================================= -->
    <div class="gallery-area overflow-hidden default-padding">
        <div class="container">
            <div class="row">
                <div class="col-lg-8 offset-lg-2">
				 <?php if($all_gal_section->have_posts()): while($all_gal_section->have_posts()):$all_gal_section -> the_post(); 
				  $gal_section_title=get_the_title();
				  $gal_section_tagline=get_field('tagline');
				  
				  ?> 
                    <div class="site-heading text-center">
                        <h4><?php echo $gal_section_title;?></h4>
                        <h2><?php echo $gal_section_tagline;?></h2>
                    </div>
				  <?php endwhile; endif;?>	
                </div>
            </div>
        </div>
        <div class="container">
            <div class="case-items-area">
                <div class="masonary">
                    <div id="portfolio-grid" class="gallery-items colums-3">
                       <?php $i=1;while($all_gal->have_posts()): $all_gal -> the_post();
							  $gal_title=get_the_title();
							  //$gal_content=get_the_content();
							  $thumb_id = get_post_thumbnail_id();
				              $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'galindex-thumb', true);
				              $thumb_url = $thumb_url_array[0]; 
							  $terms=get_the_category($post->ID);
							  $gal_show_youtube=get_field('show_video_on_popup');
							  $button='<i class="fas fa-plus"></i>';
							  $class='popup-gallery';
							  $gal_link_ar=wp_get_attachment_image_src($thumb_id, 'full', true);
							  $gal_link=$gal_link_ar[0];
							  if($gal_show_youtube=="Yes")
							  {
							      $gal_link=get_field('youtube_video_url');
								  $button='<i class="ti-control-play"></i>';
								  $class='popup-youtube';
							  }
						?>	 
						<!-- Single Item -->
                        <div class="pf-item <?php if($i==2) echo 'wide';?>">
                            <div class="item">
                                <div class="thumb">
                                    <img src="<?php echo $thumb_url;?>" alt="Thumb">
                                </div>
                                <div class="content">
								    
                                    <div class="info">
                                        <h4><a href="#"><?php echo $gal_title;?></a></h4>
										<?php if(count($terms)>0): foreach($terms as $term){$term_Array[] = ucfirst($term->name);}?>
                                        <span><?php echo implode( ', ', $term_Array );?></span>
										<?php endif;?>
                                    </div>
									
                                    <div class="button">
									
                                        <a href="<?php echo $gal_link;?>" class="item <?php echo $class;?>">
                                            <?php echo $button;?>
                                        </a>
										
                                    </div>
									
									
									
                                </div>
                            </div>
                        </div>
                        <!-- End Single Item -->

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

                    </div>
                </div>
                <div class="text-center mt-4">
                    <div class="button">
                        <a class="btn btn-gradient effect btn-md" href="<?php site_url('gallery');?>">SEE MORE</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- End Projects Area -->
    <?php endif;?>
    <!-- Start Blog 
    ============================================= -->
	<?php $arg_blog=array(
		                          "post_type"=>'blog',
								  "post_status"=>'publish',
								   "post_per_page"=>'3',
								  
								  
		                       );
		     $all_blog = new WP_Query($arg_blog);
			 if($all_blog->have_posts()):
			  $arg_blog_section=array(
		                          "post_type"=>'blog_section',
								  "post_status"=>'publish',
								 
								  
		                       );
		     $all_blog_section = new WP_Query($arg_blog_section);
			 
			  
	?>
    <div class="blog-area bg-gray default-padding bottom-less">
        <div class="container">
            <div class="row">
                <div class="col-lg-8 offset-lg-2">
				  <?php if($all_blog_section->have_posts()): while($all_blog_section->have_posts()):$all_blog_section -> the_post(); 
				  $gal_blog_title=get_the_title();
				  $gal_blog_tagline=get_field('tagline');
				  
				  ?>
                    <div class="site-heading text-center">
                        <h4><?php echo $gal_blog_title;?></h4>
                        <h2><?php echo $gal_blog_tagline;?></h2>
                    </div>
				  <?php  endwhile; endif;?>	
					
                </div>
            </div>
        </div>
        <div class="container">
            <div class="blog-items">
                <div class="row">
				
				    <?php $i=1;while($all_gal->have_posts()): $all_gal -> the_post();
							  $blog_title=get_the_title();
							  $blog_content=get_the_content();
							  $thumb_id = get_post_thumbnail_id();
				              $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'blogindex-thumb', true);
				              $thumb_url = $thumb_url_array[0]; 
							  $terms=get_the_category($post->ID);
							  
				   ?>	 
                    <!-- Single Item -->
                    <div class="single-item col-lg-4 col-md-6">
                        <div class="item">
                            <div class="thumb">
                                <img src="<?php echo $thumb_url;?>" alt="Thumb">
                                <div class="date">January 25, 2021</div>
                            </div>

                            <div class="info">
                                <!--<div class="meta">
                                   <ul>
                                       <li>
                                           <img src="<?php //echo get_template_directory_uri();?>/assets/img/100x100.png" alt="Author">
                                           <span>By </span>
                                           <a href="#">John Baus</a>
                                       </li>
                                       <li>
                                           <span>In </span>
                                           <a href="#">Agency</a>
                                       </li>
                                   </ul>
                                </div>-->
                                <h4>
                                    <a href="<?php the_permalink();?>"><?php echo $blog_title;?></a>
                                </h4>
                                <p>
                                    <?php echo mb_strimwidth( strip_tags($blog_content), 0, 120, '...' );?>
                                </p>
                            </div>
                        </div>
                    </div>
                    <!-- End Single Item -->
                    
                    
                </div>
                <div class="text-center mt-4">
                    <div class="button">
                        <a class="btn btn-gradient effect btn-md" href="<?php echo site_url('blog');?>">SEE MORE</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- End Blog Area -->
	<?php endif;?>

<?php get_footer();?>


    