<?php
/**
* The template for displaying page
* template name: Patent Template
*
* @package TSS technology
* @since TSS technology 1.0
*/

get_header();
?>	<!-- BANNER -->
<div class="section banner-page about">
		<div class="container">
			<div class="row">
				<div class="col-sm-12 col-md-12">
					<div class="title-page"><?php the_title(); ?> </div>
					<ol class="breadcrumb">
						<li><a href="<?php echo home_url(); ?>">Home</a></li>
						<li class="active"><?php the_title(); ?></li>
					</ol>
				</div>
			</div>
		</div>
	</div>
	<?php $args = array('post_type'=>'patent');

	$qr = new WP_Query($args);

	if($qr->have_posts())
	{
 ?>
	 
<div class="section why overlap">
		<div class="container">
			<div class="row">
				<div class="col-sm-12 col-md-12">
					<h2 class="section-heading">
						<?php the_title(); ?>
					</h2>
				</div>
			</div>
			<?php $i=1; while ($qr->have_posts()) { 
						$qr->the_post();
						$content = get_the_content();
						$img_url = wp_get_attachment_url(get_post_thumbnail_id($post->ID),'full');
						if($i%2 != 0){


				 ?>
			<div class="row">
				<div class="col-sm-6 col-md-4">
					<div class="box-image-4">
						<a href="#">
							<div class="media">
								<img src="<?php echo $img_url; ?>" alt="" class="img-responsive">
							</div>
							<div class="body">
								<div class="content">
									<h4 class="title"><?php the_title(); ?></h4>
									<span class="category"><?php the_field('category'); ?></span>
								</div>
							</div>
						</a>
					</div>
				</div>
				<div class="col-sm-6 col-md-8">
					<?php the_content(); ?>
				</div>
			</div>
		<?php } else { ?>

				<div class="row">
					<div class="col-sm-6 col-md-8">
					<?php the_content(); ?>
				</div>
				<div class="col-sm-6 col-md-4">
					<div class="box-image-4">
						<a href="#">
							<div class="media">
								<img src="<?php echo $img_url; ?>" alt="" class="img-responsive">
							</div>
							<div class="body">
								<div class="content">
									<h4 class="title"><?php the_title(); ?></h4>
									<span class="category"><?php the_field('category'); ?></span>
								</div>
							</div>
						</a>
					</div>
				</div>
			</div>
		<?php } $i++; } ?>
   
		</div>
	</div>	
<?php } get_footer(); ?>