<?php
	if($counter == 1)
	{
		$next_count_for_large_grid = 5;
		$count_for_large_grid = 0;
	}
	
	$blog_featured_image_size = 'musico-gallery-list';
	$large_grid_class = '';
	
	if($counter == 1 OR $count_for_large_grid == $next_count_for_large_grid)
	{
		$blog_featured_image_size = 'full';
		$large_grid_class = 'large_grid';
		
		if($counter > 1)
		{
			$count_for_large_grid = 0;
			if($next_count_for_large_grid == 5)
			{
				$next_count_for_large_grid = 1;
			} 
			else if($next_count_for_large_grid == 1)
			{
				$next_count_for_large_grid = 5;
			}
		}
	}
	
	$blog_featured_img_url = '';
	if(!empty($image_thumb))
	{
		$blog_featured_img_url = get_the_post_thumbnail_url($post_ID, $blog_featured_image_size);
	}
?>

<!-- Begin each blog post -->
<div <?php post_class(array('blog-posts-'.$settings['layout'], 'blog-tilt', $large_grid_class, 'count_for_large_'.$count_for_large_grid, 'next_for_large'.$next_count_for_large_grid)); ?> <?php if(!empty($blog_featured_img_url)) { ?>style="background-image:url(<?php echo esc_url($blog_featured_img_url); ?>);"<?php } ?>>
	
	<div class="bg_overlay"></div>

	<div class="post_wrapper">
		
		<div class="post_content_wrapper text_<?php echo esc_attr($settings['text_align']); ?>">
		    
		    <div class="post_header">
			    <?php
				  	if($settings['show_categories'] == 'yes') 
				  	{
				?>
			    <div class="post_detail single_post">
			    	<span class="post_info_cat">
						<?php
						   //Get Post's Categories
						   $post_categories = wp_get_post_categories($post_ID);
						   
						   $count_categories = count($post_categories);
						   $i = 0;
						   
						   if(!empty($post_categories))
						   {
						      	foreach($post_categories as $key => $c)
						      	{
						      		$cat = get_category( $c );
						?>
						      	<a href="<?php echo esc_url(get_category_link($cat->term_id)); ?>"><?php echo esc_html($cat->name); ?></a>
						<?php
							   		if(++$i != $count_categories) 
							   		{
							   			echo '&nbsp;&middot;&nbsp;';
							   		}
						      	}
						   }
						?>
			    	</span>
			 	</div>
			 	<?php
				 	}
				?>
				<div class="post_header_title">
				    <h5><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h5>
				</div>
				
				<div class="post_header_wrapper">
				<?php
			    	switch($settings['text_display'])
			    	{
				    	case 'full_content':
				    		if($settings['strip_html'] == 'yes')
				    		{
					    		echo strip_tags(get_the_content());
				    		}
				    		else
				    		{
				    			echo get_the_content();
				    		}
				    	break;
				    	
				    	case 'excerpt':
				    		if($settings['strip_html'] == 'yes')
				    		{
					    		echo musico_limit_get_excerpt(strip_tags(get_the_excerpt()), $settings['excerpt_length']['size'], '...');
					    	}
					    	else
					    	{
				    			echo musico_limit_get_excerpt(get_the_excerpt(), $settings['excerpt_length']['size'], '...');
				    		}
				    	break;
			    	}
			    ?>
			    <?php
				  	if($settings['show_date'] == 'yes') 
				  	{
				?>
			    <div class="post_button_wrapper">
			    	<div class="post_attribute">
					    <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo date_i18n(MUSICO_THEMEDATEFORMAT, get_the_time('U')); ?></a>
					</div>
			    </div>
			    <?php
				    }
				?>
			</div>
			</div>
	    </div>
	    
	</div>

</div>

<!-- End each blog post -->
<?php
	$count_for_large_grid++;	
?>