<?php
/**
 * Template part for displaying posts.
 *
 * @package daisy
 */
global $rst_blog;
global $name_now;
$template = $rst_blog['template'];
if( $template == 'large' ) {
?>
<div id="post-<?php the_ID(); ?>" <?php post_class('post-block col-md-12'); ?>> <!-- Post #1-->
	<div class="post-detail">
		<div class="meta-cat">
			<?php the_category(','); ?>
		</div>
		<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <!-- Post Title-->
		<div class="metas">
			<?php
				if( $name_now == 'search' ){
					if( !get_theme_mod('search_hide_date') ){ 
					?>
						<a href="<?php echo get_day_link(get_post_time('Y'), get_post_time('m'), get_post_time('j')); ?>" class="meta-date"><?php echo mysql2date('d F', $post->post_date) ?></a>
					<?php } 
					if( !get_theme_mod('search_hide_author') ){ ?>
					
						<a href="<?php echo get_author_posts_url( $post->post_author ); ?>" class="meta-author"><?php the_author()?></a>
					<?php } 
					if( !get_theme_mod('search_hide_conment_count') ){ ?>
						<a href="<?php comments_link(); ?>" class="meta-comment"><?php comments_number('0 Comment', '1 Comment', '% Comments');?></a>
					<?php } 
				}
				elseif( is_category() || is_author() ){
					if( !get_theme_mod('cat_hide_date') ){ 
					?>
						<a href="<?php echo get_day_link(get_post_time('Y'), get_post_time('m'), get_post_time('j')); ?>" class="meta-date"><?php echo mysql2date('d F', $post->post_date) ?></a>
					<?php } 
					if( !get_theme_mod('cat_hide_author') ){ ?>
						<a href="<?php echo get_author_posts_url( $post->post_author ); ?>" class="meta-author"><?php the_author()?></a>
					<?php } 
					
					if( !get_theme_mod('cat_hide_conment_count') ){ ?>
						<a href="<?php comments_link(); ?>" class="meta-comment"><?php comments_number('0 Comment', '1 Comment', '% Comments');?></a>
					<?php } 
				}else{
					if( !get_theme_mod('general_hide_date') ){ 
					?>
						<a href="<?php echo get_day_link(get_post_time('Y'), get_post_time('m'), get_post_time('j')); ?>" class="meta-date"><?php echo mysql2date('d F', $post->post_date) ?></a>
					<?php } 
					if( !get_theme_mod('general_hide_author') ){ ?>
						<a href="<?php echo get_author_posts_url( $post->post_author ); ?>" class="meta-author"><?php the_author()?></a>
					<?php } 
					if( !get_theme_mod('general_hide_conment_count') ){ ?>
						<a href="<?php comments_link(); ?>" class="meta-comment"><?php comments_number('0 Comment', '1 Comment', '% Comments');?></a>
					<?php } 
					?>
				<?php	
				}
				?>
		</div>
	</div>
	<?php 
		get_template_part( 'thumbnail', get_post_format() );
	?>
	<div class="rst-post-excerpt">
		<?php 
			if(isset($rst_blog['excerpt_length']) && !empty($rst_blog['excerpt_length'])){
				echo get_excerpt_by_id($post, absint($rst_blog['excerpt_length']) );
			}else{
				the_content(' ');
				wp_link_pages( array(
					'before' => '<div class="page-links">' . __( '<span>Pages:</span>', 'rst' ),
					'after'  => '</div>',
				));
			}
		?>
	</div>
	<div class="text-center">
		<?php 
			if((isset($rst_blog['excerpt_length']) && !empty($rst_blog['excerpt_length'])) || strpos( $post->post_content, '<!--more-->' )){
		?>
		<a href="<?php the_permalink(); ?>" class="btn btn-default tf-btn txt-link"><?php rst_the_translate('Continue reading...','translation_continue_reading') ?></a>
		<?php
			}
		?>
	</div>
</div><!-- end Post #1-->
<?php
}
else {
?>
	<?php
		$column = absint( 12/$rst_blog['column'] );
		$class = 'col-md-'. $column;
	?>	
		<div id="post-<?php the_ID(); ?>" <?php post_class( $class . ' col-sm-6 post-block grid'); ?>>
	<?php
		get_template_part( 'thumbnail', get_post_format() );
	?>
	<div class="post-detail">
		<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <!-- Post Title-->
		<div class="metas">
			
			<?php
				if( $name_now == 'search' ){
					if( !get_theme_mod('search_hide_date') ){ 
					?>
						<a href="<?php echo get_day_link(get_post_time('Y'), get_post_time('m'), get_post_time('j')); ?>" class="meta-date"><?php echo mysql2date('d F', $post->post_date) ?></a>
					<?php } 
				}
				elseif( is_category() || is_author() ){
					if( !get_theme_mod('cat_hide_date') ){ 
					?>
						<a href="<?php echo get_day_link(get_post_time('Y'), get_post_time('m'), get_post_time('j')); ?>" class="meta-date"><?php echo mysql2date('d F', $post->post_date) ?></a>
					<?php } 
				}else{
					if( !get_theme_mod('general_hide_date') ){ 
					
				?>	
					<a href="<?php echo get_day_link(get_post_time('Y'), get_post_time('m'), get_post_time('j')); ?>" class="meta-date"><?php echo mysql2date('d F', $post->post_date) ?></a>
			<?php } 
				}
			?>
		</div>
	</div>
	<div class="rst-post-excerpt">
		<?php 
			if(isset($rst_blog['excerpt_length']) && !empty($rst_blog['excerpt_length'])){
				echo get_excerpt_by_id($post, absint($rst_blog['excerpt_length']) );
			}else{
				the_content(' ');
				wp_link_pages( array(
					'before' => '<div class="page-links">' . __( '<span>Pages:</span>', 'rst' ),
					'after'  => '</div>',
				));
			}
		?>
	</div>
	<div class="text-center">
		<?php 
			if((isset($rst_blog['excerpt_length']) && !empty($rst_blog['excerpt_length'])) || strpos( $post->post_content, '<!--more-->' )){
		?>
		<a href="<?php the_permalink(); ?>" class="btn btn-default tf-btn txt-link"><?php rst_the_translate('Continue reading...','translation_continue_reading') ?></a>
		<?php
			}
		?>
	</div>
</div>
<?php	
}
?>