<?php  
	$blog_ttl 		= get_theme_mod('blog_ttl');
	$blog_num		= get_theme_mod('blog_num','4');
?>
<!-- START: BLOGS -->
<section class="post-home latest-blog pt-default" id="latest-blog1">
	<div class="bg-blog-1 bg-elements"><img src="<?php echo esc_url(get_template_directory_uri().'/assets/images/bg-elements/element-4.png'); ?>" alt="<?php echo esc_attr__('bg-elements','flossy'); ?>">
	</div>
	<div class="bg-blog-2 bg-elements"><img src="<?php echo esc_url(get_template_directory_uri().'/assets/images/bg-elements/element-11.png'); ?>" alt="<?php echo esc_attr__('bg-elements','flossy'); ?>">
	</div>
	<div class="bg-blog-3 bg-elements"><img src="<?php echo esc_url(get_template_directory_uri().'/assets/images/bg-elements/element-13.png'); ?>" alt="<?php echo esc_attr__('bg-elements','flossy'); ?>">
	</div>
	<div class="container">	
		<?php if(!empty($blog_ttl)){ ?>	
			<div class="row">
				<div class="col-12 text-center wow fadeInRight">
					<div class="heading-1 text-center">

						<?php if(!empty($blog_ttl)): ?>
							<h2>
								<?php echo wp_kses_post($blog_ttl); ?>
							</h2>
						<?php endif; ?>

					</div>
				</div>
			</div>
		<?php } ?>
		<div class="blog-slider">
			<?php 
				$flossy_blog_args = array( 'post_type' => 'post', 'posts_per_page' => $blog_num,'post__not_in'=>get_option("sticky_posts")) ; 	
			
				$flossy_wp_query = new WP_Query($flossy_blog_args);
				if($flossy_wp_query)
				{	
				 $post_count=0;
				while($flossy_wp_query->have_posts()):$flossy_wp_query->the_post();
			
					$terms = get_the_category( $post->ID, 'post' );
										
					if ( $terms && ! is_wp_error( $terms ) ) : 
						$links = array();

						foreach ( $terms as $term ) 
						{
							$links[] = $term->slug;
						}
						
						$tax = join( ' ', $links );		
					else :	
						$tax = '';	
					endif;
			?>
		
			<div class="blog-slider-wrapper <?php echo strtolower($tax); ?>" >
				<?php get_template_part('template-parts/content/content','page'); ?>
			</div>
			<?php 
					endwhile; 
				}
				wp_reset_postdata();
			?>
			
		</div>
	</div>

</section>

<!-- END: BLOGS -->

