<?php
/*
Template Name: Services
*/
?>
<?php get_header();?>
   <div class="content-wrapper">
    	<div class="container">
    		<h3><?php get_field('page_title')? the_field('page_title') :  the_title(); ?></h3>
    		<div class="row-fluid services-elem">
			   <?php 
				$columns = get_field("columns_type");
				
			   setup_postdata( $post );
				   $count = 0;
				   $args = array(
									'post_type' => 'service_post',
									'posts_per_page' => -1,
								);
								$the_query = new WP_Query($args);
					while ( $the_query->have_posts() ):
							$the_query->the_post();?>	
									
					<?php //if($count <2 ):?>	
				<?php 
					
				if($columns==2):?>	
				<div class="span6">
					<div id="col-container">
						<table>
							<tr>
								<td>
								<div class="services-logo">
									<?php if (get_field('service_type')=='FontAwsome'){?>									
										<i class="<?php the_field('font_awesome'); ?> icon-3x" style="color:<?php the_field('font_awesome_color');?>;"></i>									
									<?php } else {
										$image = wp_get_attachment_image_src(get_field('image'));	
									    echo  '<img src="'.$image[0].'" alt=""/>';	
									}?>
								</div>	
								</td>
								<td>
									<p class="post-title"><?php the_title();?></p>
									<p class="post-categoty add-pading">
										<?php the_content();?>
										</p>
								</td>
							</tr>
						</table>
    				</div>
    			</div>
				<?php else:?>
						
				<div class="span3">
							<div id="col-container">							
								<div class="services-logo sized-center add-pading">
								<?php if (get_field('service_type')=='FontAwsome'){?>	
									<i class="<?php the_field('font_awesome'); ?> icon-3x" style="color:<?php the_field('font_awesome_color');?>;"></i>
									<?php } else {
										$image = wp_get_attachment_image_src(get_field('image'));	
									    echo  '<img src="'.$image[0].'" alt=""/>';	
									}?>
								</div>
								<p class="post-title text-center add-pading"><?php the_title(); ?></p>
								<p class="post-categoty add-pading">
									<?php the_content();?>
								</p>
							</div>
						</div>
				 <?php endif ;?>
				 <?php $count++;?>		
				<?php endwhile;?>
    		</div>
    	</div><!--container-->
    </div><!--.content-wrapper-->
	  <?php  wp_reset_postdata();?>
	  <div class ="theContent">
        <?php setup_postdata($post);?>
        <?php the_content();?>
        <?php wp_reset_postdata();?>
    </div>
<?php get_footer();?>