<?php
/**
 * The template for displaying Archive pages
 */

get_header(); ?>

	<div id="primary" class="content-area">
		

		<div id="content" class="site-content serviceslist" role="main">

		<?php $j = 0; if ( have_posts() ) : ?>
			<?php theguard_hide_services(); ?>
			
			<div class="<?php theguard_services_column_clear(); ?>">
			<?php while ( have_posts() ) : the_post(); ?>
				<?php $servico = types_render_field( "sicon", array("url" => "true")); ?>

				<div class="<?php theguard_services_column_control(); ?> sell_services">
				<?php if (++$j % 2 == 0) { ?>
					<div>
					<div class="entry-thumbnail"><?php
						if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
							the_post_thumbnail( 'theguard_services' );
						}
						?>
					</div>
					<div class="service_wrapper">
						<?php
						if (isset ($servico)) {
							echo '<a href="';
							the_permalink();
							echo '" class="ico"><img src="'.esc_url($servico).'" alt="'.get_the_title().'"></a>';
						} else {
							echo '<a href="';
							the_permalink();
							echo '" class="ico"><img src="'.esc_url(get_template_directory_uri()).'/images/sicon.png" alt="'.get_the_title().'"></a>';
						}
						?>
						<h5><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>
						<?php the_excerpt(); ?>
						<a href="<?php the_permalink(); ?>" class="more"><?php theguard_services_rmore(); ?> <i class="fa fa-arrow-right"></i></a>
					</div>
					</div>
				<?php } else { ?>
				<div>
					<div class="service_wrapper">
						<?php
						if (isset ($servico)) {
							echo '<a href="';
							the_permalink();
							echo '" class="ico"><img src="'.esc_url($servico).'" alt="'.get_the_title().'"></a>';
						} else {
							echo '<a href="';
							the_permalink();
							echo '" class="ico"><img src="'.esc_url(get_template_directory_uri()).'/images/sicon.png" alt="'.get_the_title().'"></a>';
						}
						?>
						<h5><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>
						<?php the_excerpt(); ?>
						<a href="<?php the_permalink(); ?>" class="more"><?php theguard_services_rmore(); ?> <i class="fa fa-arrow-right"></i></a>
					</div>
					<div class="entry-thumbnail"><?php
						if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
							the_post_thumbnail( 'theguard_services' );
						}
						?>
					</div>
				</div>

				<?php } ?>
				</div>

			<?php endwhile; ?>
			</div>
		</div><!-- #content -->

		<?php theguard_paging_nav(); ?>

		<?php else : ?>
			<?php get_template_part( 'content', 'none' ); ?>
		<?php endif; ?>


	</div><!-- #primary -->

<?php get_footer(); ?>
