<?php



// Template Name: Blog Template



?>

<?php get_header('inner'); ?>


<section class="middle row">
<div class="Mid_top Align_cent"><div class="container Gray2 OswalReg36 Letter_space2 Upparcase"><?php echo $data['blog_header'];?></div></div>

<div class="Main_mid contmain row Offset6">
<div class="container">
<?php  if($data['show_removesidebar'] !=0) {   ?>

<article class="Blog_detail colm_3 Fl">
<?php
$paged = get_query_var('paged') ? get_query_var('paged') : 1;	
 query_posts(array('post_type' => 'post', 'posts_per_page' =>'2', 'paged' => $paged )); 



             	if (have_posts()) : while (have_posts()) : the_post();
				$large_image =  wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'fullsize', false, '' ); 



                $large_image = $large_image[0]; 
				?>


<div class="Blog_post">
<?php  if($data['show_image'] !=0) {  

   if ( has_post_thumbnail() ) 
                       { ?>
                    <div class="block max_width"><a href="<?php the_permalink();?>"><?php the_post_thumbnail('full'); ?></a></div>
                      
                       
                       <?php
                       } 
                       else if($data['blog_image'] != '')
                       { 
                       ?>


<div class="img row Offset10"><a href="<?php the_permalink(); ?>"><img src="<?php echo $large_image ?>" alt="img"></a></div>
<?php }} ?>

<div class="Blog_row">
<h3><?php the_title(); ?></h3>
<p>by <span class="Yellow3"><?php echo get_the_author(); ?></span> &nbsp;&nbsp; in <span class="Yellow3">Post with image</span></p>
<p class="Offset2"><?php $content= strip_tags(get_the_content()); 
//echo substr($content,0,500)."....";
echo strlen($content) > 500? substr($content,0,500)."..." : $content;
?></p>
</div>
<div class="Blog_bottom row ">
<div class="Read_more Fl"><a href="<?php the_permalink(); ?>">Read More &raquo;</a></div>

<div class="Blog_botm_right">
<div class="comment fa fa-comment "><span class="Helvetica14 Gray5"><?php
$comments_count = wp_count_comments( get_the_id() );
echo $comments_count->approved; ?></span></div>
<!--<div class="like fa fa-heart"><span class="Helvetica14 Gray5">25</span></div>-->
<div class="Blog_date">
<div class="Date Helvetica12  Align_cent Italic"><?php echo get_the_date(); ?></div>
<div class="Blog_Calendar"><a href="" class="fa fa-calendar"></a></div>
</div>

</div>

</div>


</div>


 <?php endwhile; endif; ?>




<div class="pagination">
 <?php if (function_exists("pagination")) {pagination();} ?>
</div>
</article>
<?php } else { ?>

<article class="Blog_detail colm_6 Fl">
<?php
$paged = get_query_var('paged') ? get_query_var('paged') : 1;	
 query_posts(array('post_type' => 'post', 'posts_per_page' =>'2', 'paged' => $paged )); 



             	if (have_posts()) : while (have_posts()) : the_post();
				$large_image =  wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'fullsize', false, '' ); 



                $large_image = $large_image[0]; 
				?>


<div class="Blog_post">
<?php  if($data['show_image'] !=0) {   ?>
<div class="img row Offset10"><a href="<?php the_permalink(); ?>"><img src="<?php echo $large_image ?>" alt="img"></a></div>
<?php } ?>

<div class="Blog_row">
<h2><?php the_title(); ?></h2>
<p>by <span class="Yellow3"><?php echo get_the_author(); ?></span> &nbsp;&nbsp; in <span class="Yellow3">Post with image</span></p>
<p class="Offset2"><?php $content= strip_tags(get_the_content()); 
echo substr($content,0,500)."....";

?></p>
</div>
<div class="Blog_bottom row ">
<div class="Read_more Fl"><a href="<?php the_permalink(); ?>">Read More &raquo;</a></div>

<div class="Blog_botm_right">
<div class="comment fa fa-comment "><span class="Helvetica14 Gray5">3</span></div>
<div class="like fa fa-heart"><span class="Helvetica14 Gray5">25</span></div>
<div class="Blog_date">
<div class="Date Helvetica12  Align_cent Italic"><?php echo get_the_date(); ?></div>
<div class="Blog_Calendar"><a href="" class="fa fa-calendar"></a></div>
</div>

</div>

</div>


</div>


 <?php endwhile; endif; ?>




<div class="pagination">
 <?php if (function_exists("pagination")) {pagination();} ?>
</div>
</article>

<?php   } ?>

<?php  if($data['show_removesidebar'] !=0) {   ?>
<aside class="Blog_right colm_4 Fr">
<div class="Enter_keyword">
<div class="Enter_input"><input name="" value="Enter keywords" type="text"></div>
<div class="Enter_search_bnt"><a href="#"><img src="<?php bloginfo('template_url'); ?>/images/search_btn.jpg" alt="img" border="0"></a></div>
</div>

<div class="Recent_post Right_colm">
<?php get_sidebar('main-sidebar');?>

</div>
</aside>
<?php } ?>




</div>
</div>












</section>


<?php get_footer();?>