<?php
/*
Template Name: Testimonials
*/
?>
<?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">
    			<div class="span12" id="item-testmonials">
				 <?php 
					   $count = 0;
					   $post_num  = get_field("post_on_page");
					   $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
					   $args = array(
										'post_type' => 'testmonials_post',													
										'posts_per_page' => $post_num ,
										'paged'     => $paged
									);
						$the_query = new WP_Query($args);
						$countpost = wp_count_posts('testmonials_post');
						while ( $the_query->have_posts() ):
								$the_query->the_post();?>	
						<script>
						var num_of_posts = <?php echo $post_num;?>;
						var maxNumPages = "<?php  echo $the_query->max_num_pages;?>";
						</script>
						
									
    				<div class="up-container">
    					<div class="testmonial-container">
						<?php if($count % 2 == 0 ){
								   echo '<div class="testmonial-inner testmonial-quote testmonial-border">';?>				
											<p class="comment">
											<?php   $content =  get_the_content();
													echo $content;
											?>
											</p>
										</div>
								<?php echo '<div class="testmonial-inner testmonial-arrow-first">';?>
											<div class="testmonial-triangle-border"></div>
											<div class="testmonial-triangle-body"></div>
										</div>
								<?php echo '<div class="testmonial-inner testmonial-author testmonial-right">';?>
											<?php if(get_field("link")){?>
											<a href="<?php the_field("link");?>"><p class="post-title"><?php the_title();?></p>
											<p class="post-categoty capitalize"><?php the_field("position");?></p></a>
											<?php }	else{?>
												<p class="post-title"><?php the_title();?></p>
												<p class="post-categoty capitalize"><?php the_field("position");?></p>
											<?php 	}?>
										</div>
							<?php
							}
							else
							{
								echo '<div class="testmonial-inner testmonial-author">';?>
									<?php if(get_field("link")){?>
										<a href="<?php the_field("link");?>"><p class="post-title"><?php the_title();?></p>
										<p class="post-categoty capitalize"><?php the_field("position");?></p></a>
										<?php }	else{?>
										<p class="post-title"><?php the_title();?></p>
										<p class="post-categoty capitalize"><?php the_field("position");?></p>
										<?php 	}?>
									</div>							
								<?php echo '<div class="testmonial-inner testmonial-arrow-second">';?>
										<div class="testmonial-triangle-border"></div>
										<div class="testmonial-triangle-body"></div>
									</div>
								<?php echo '<div class="testmonial-inner testmonial-quote testmonial-border-left">';?>
										<p class="comment">
											<?php   $content =  get_the_content();
													echo $content;
											?>
										</p>
									</div>
									<?php
							}
							?>	
	    				</div>
    				</div>					
				 <?php $count++;?>		
				<?php endwhile;?>					
    			</div>
				<?php 
				if(	$countpost->publish>$post_num) :?>
    			<div class="row">
					<div class="span12">
						<p id="load-more-testmonials" class="load-more"><?php echo _e('LOAD','hybrid_lang');?> <br> <?php echo _e('MORE','hybrid_lang');?></br>...</p>
					</div>
				</div>
				<?php endif; ?>
    		</div>
    	</div><!--container-->
    </div><!--.content-wrapper-->
	<div class ="theContent">
	  <?php wp_reset_postdata();?>
        <?php setup_postdata($post);?>
        <?php the_content();?>
        <?php wp_reset_postdata();?>
    </div>
<?php get_footer();?>