<section id="ourservice-section" class="ourservice-area home-ourservice">
    <?php 
        $toppawingicon = get_template_directory_uri().'/assets/images/toppawimage.png';
    ?>
    <div class="container">
        <div class="heading">
            <div class="headimg">
                <?php 
                    if(!empty($serhead_image)){
                        echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($serhead_image).'"  />';
                    }else{
                        echo '<img src="'.get_template_directory_uri().'/assets/images/titleimg.png" />';
                    }
                ?>
            </div>
            <h2><?php echo esc_html(get_theme_mod('ourservice_heading')); ?></h2>
            <h3><?php echo esc_html(get_theme_mod('ourservice_subheading')); ?></h3>
        </div>
        <div class="ourtbx"> 
            <div class="row">

                <div class="col-lg-6 col-md-12 pd-0">
                    <?php for($p=1; $p<6; $p++) { ?>
                    <?php if( get_theme_mod('ourservice'.$p,false)) { ?>
                    <?php $querycolumns = new WP_query('page_id='.get_theme_mod('ourservice'.$p,true)); ?>
                    <?php while( $querycolumns->have_posts() ) : $querycolumns->the_post(); 
                    $image = wp_get_attachment_image_src(get_post_thumbnail_id() , true); ?>
                    <?php 
                    if(has_post_thumbnail()){
                        $img = esc_url($image[0]);
                    }
                    if(empty($image)){
                        $img = get_template_directory_uri().'/assets/images/default.png';
                    }
                    ?>

                    <div class="box-space lhs pd-0">
                        <div class="threebox box<?php echo esc_attr( $p ) ?> <?php if($p % 3 == 0) { echo "last_column"; } ?>">
                            <div class="row">              
                                <div class="part-2">
                                    <a href="<?php echo esc_url( get_permalink() ); ?>">
                                        <h3 class="title"><?php the_title_attribute(); ?></h3>
                                    </a>
                                    <div class="description"><?php the_excerpt(); ?></div>
                                </div>
                                <div class="single-ourservice">
                                    <img src="<?php echo esc_url($img); ?>" alt="<?php the_title_attribute(); ?>">
                                </div>
                            </div>
                        </div>
                    </div>
                    <?php endwhile;
                    wp_reset_postdata(); ?>
                    <?php } } ?>
                </div>
                <div class="col-lg-6 col-md-12 pd-0">
                    <?php for($p=6; $p<11; $p++) { ?>
                    <?php if( get_theme_mod('ourservice'.$p,false)) { ?>
                    <?php $querycolumns = new WP_query('page_id='.get_theme_mod('ourservice'.$p,true)); ?>
                    <?php while( $querycolumns->have_posts() ) : $querycolumns->the_post(); 
                    $image = wp_get_attachment_image_src(get_post_thumbnail_id() , true); ?>
                    <?php 
                    if(has_post_thumbnail()){
                        $img = esc_url($image[0]);
                    }
                    if(empty($image)){
                        $img = get_template_directory_uri().'/assets/images/default.png';
                    }
                    ?>

                    <div class="box-space rhs pd-0">
                        <div class="threebox box<?php echo esc_attr( $p ) ?> <?php if($p % 3 == 0) { echo "last_column"; } ?>">  
                            <div class="row">  
                                <div class="single-ourservice">
                                    <img src="<?php echo esc_url($img); ?>" alt="<?php the_title_attribute(); ?>">
                                </div>
                                <div class="part-2">
                                    <a href="<?php echo esc_url( get_permalink() ); ?>">
                                        <h3 class="title"><?php the_title_attribute(); ?></h3>
                                    </a>
                                    <div class="description"><?php the_excerpt(); ?></div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <?php endwhile;
                    wp_reset_postdata(); ?>
                    <?php } } ?>
                </div>
                
                <div class="clear"></div> 
            </div>
            <div class="bttn">
                <a href="<?php echo esc_html(get_theme_mod('ourservice_readmorebtnlink')); ?>">
                    <?php esc_html_e('See More','automotive-mechanic'); ?>  
                </a>
            </div>
        </div> 
	</div>
</section>
