<?php 
$allowed_html_array = array(
					'b' => array(),
					'br' => array(),
					'span' => array('class' => array()),
					'div' => array('class' => array()),
					'p' => array('class' => array()),
					);
?>
<?php if(monix_get_option('monix_blog_page_heading_section') == 1 && monix_is_only_blog()){ ?>
<!-- =-=-=-=-=-=-= PAGE HEADING SECTION =-=-=-=-=-=-= -->
  <?php if (function_exists('monix_page_heading_function')) monix_page_heading_function(); ?>
<!-- =-=-=-=-=-=-= PAGE HEADING SECTION END =-=-=-=-=-=-= -->
<?php } ?>		
	
<?php if(monix_get_option('monix_blog_page_breadcrumb_section') == 1 && monix_is_only_blog()){ ?>
<!-- =-=-=-=-=-=-= PAGE BREADCRUMB SECTION =-=-=-=-=-=-= -->
  <?php if (function_exists('monix_page_breadcrumb_function')) monix_page_breadcrumb_function(); ?>
<!-- =-=-=-=-=-=-= PAGE BREADCRUMB SECTION END =-=-=-=-=-=-= -->
<?php } ?>
        <!-- Start Blog -->
        <section class="blog-section" id="full-blog-section">
		<?php if(paginate_links()) { ?>	
			<div id="pagiloader" class="pagiloader"><img src="<?php echo esc_url(get_template_directory_uri().'/images/loader-blog.gif') ?>" class="img-responsive" /></div>
		<?php } ?>	
			<div class="content">
            <div class="container p-60-0-30" >
			<div class="blog-title-section">
			<?php if(monix_get_option('monix_blog_section_title') != ''){ ?>
                <!-- Section title -->
                <h2 class="thin mb-15"><?php echo  wp_kses(monix_get_option('monix_blog_section_title'),$allowed_html_array);?></h2>
			<?php } ?>	
			<?php if(monix_get_option('monix_blog_section_description') != ''){ ?>
			<!-- Text -->
                <p class="light thin mb-60"><?php echo wp_kses(monix_get_option('monix_blog_section_description'),$allowed_html_array); ?></p>
			<?php } ?>	
			</div>
                <div class="row">
			<?php 
			if (have_posts()) :  while ( have_posts() ) : the_post();
					$monix_global_post = monix_get_global_post();
					$monix_get_global_wpquery = monix_get_global_wpquery();
					$postid = $monix_global_post->ID;
					$get_image = wp_get_attachment_url( get_post_thumbnail_id($postid) ); 
					$archive_month = get_the_time('M'); 
					$archive_day   = get_the_time('d'); 
					$excerpt   = get_the_excerpt(); 	
					$title = get_the_title();
				?>	
<!-- Start Blog Item -->				
                    <div <?php if( ($monix_get_global_wpquery->post_count == 1) && (is_home()) ){ post_class( 'col-12 col-lg-12 item mb-30' ); } else { post_class( 'col-12 col-lg-6 item mb-30' ); } ?> id="post-<?php the_ID(); ?>">
					<div class="post-inside-wrapper">
					<?php if(!empty($get_image)){?>
                        <a href="<?php esc_url(the_permalink()); ?>">
                            <div class="post-img mb-30">
                                <div class="pub-img" style="background-image: url(<?php echo esc_url( $get_image ); ?>); background-position: center"></div>
						<?php if(monix_get_option('monix_blog_date_info') == 1){?>
					<?php if(monix_get_option('monix_blog_wp_date_format') == 1){ ?> 		
					<div class="date bg-color-2"><p><?php echo esc_attr(get_the_date()); ?></p></div><?php	
					}else{ ?>
					<div class="date bg-color-2">
                                    <span class="bold h4"><?php echo esc_attr($archive_day); ?></span>
                                    <p><?php echo esc_attr($archive_month); ?></p>
                                   </div>
						<?php } ?>						
						<?php  } ?>
                            </div>
                        </a>
					<?php }else{ ?>
                        <a href="<?php esc_url(the_permalink()); ?>">
                            <div class="post-img mb-30">
                                <div class="pub-img" style="background-image: url(<?php echo esc_url(get_template_directory_uri()); ?>/images/blog/blog.jpg); background-position: center"></div>
					<?php if(monix_get_option('monix_blog_date_info') == 1){?>
					<?php if(monix_get_option('monix_blog_wp_date_format') == 1){ ?> 		
					<div class="date bg-color-2"><p><?php echo esc_attr(get_the_date()); ?></p></div><?php	
					}else{ ?>
					<div class="date bg-color-2">
                                    <span class="bold h4"><?php echo esc_attr($archive_day); ?></span>
                                    <p><?php echo esc_attr($archive_month); ?></p>
                                   </div>
						<?php } ?>						
						<?php  } ?>
                            </div>
                        </a>
					<?php } ?>					
                        <div class="post-descr">
                            <!-- Element title -->
                            <h4 class="bold mb-15"><?php if(!empty($title)){ echo substr($title, 0,50) ?><?php } ?></h4>
                            <!-- Text -->
                            <p class="light thin mb-15">
					<?php if ( has_post_format( 'video' ) ) : ?>
					<?php the_content(); ?>
					<?php else: ?>
					<?php if(!empty($excerpt)){ echo substr($excerpt, 0,70) ?>...<?php } ?>
					<?php endif; ?>
							</p>
                            <!-- Link -->
                            <a class="item-link link bold" href="<?php the_permalink(); ?>"><?php if(monix_get_option('monix_blog_section_post_btn_label') != ''){ echo esc_attr(monix_get_option('monix_blog_section_post_btn_label','monix')); } else { echo esc_html__('Read more','monix'); } ?> <i class="fas fa-chevron-right"></i></a>
                        </div>
                    </div>
                    </div>
<!-- End Blog Item -->
			<?php endwhile; endif; ?>
			<div class="clearfix"></div>						
                </div>				
            </div>
			<?php if(paginate_links()) { ?>
			<div class="container-fluid nopadding">
		<!-- Start Pagination-->	
        <div class="bg-color-1 p-60-0-60 blog-pagination" >
            <div class="container text-center">
				<?php 
				if (function_exists('monix_custom_pagination')) monix_custom_pagination();
				?>	
            </div>
        </div>			  
		<!--End Pagination-->
			<?php } ?>
			</div>
		<?php wp_reset_query(); ?>	
		</div>	
        </section>
		<div class="clearfix"></div>
        <!-- End Blog -->	
<?php if(monix_get_option('monix_categorised_blog_section') == 1){ ?>
        <!-- Start Categorised Blog posts Section-->
        <section class="p-60-0-30 categorised-blog">
            <div class="container">
                <div class="row">
                    <div class="col-12 col-md-8 text-center text-md-left">
				<?php if(monix_get_option('monix_categorised_blog_section_title') != ''){ ?>
                <!-- Section title -->
                <h2 class="thin mb-60 categorised-blog-title"><?php echo  wp_kses(monix_get_option('monix_categorised_blog_section_title'),$allowed_html_array);?></h2>
				<?php } ?>	
                    </div>
                    <div class="col-12 col-md-4 mb-30">
                        <!-- Testimonials navigation buttons -->
                        <div class="blog-nav"></div>
                    </div>
                    <div class="owl-carousel-blog owl-carousel owl-theme col-12">
			<?php 
if(!empty(monix_get_option('monix_categorised_blog_section_post_no'))){
	$post_per_page = monix_get_option('monix_categorised_blog_section_post_no');
}else{
	$post_per_page='4';
}	
if(!empty(monix_get_option('monix_categorised_blog_category'))){
	$cat_id = monix_get_option('monix_categorised_blog_category');
}else{
	$cat_id ='';
}		
			$args = array(
			'cat'          => $cat_id,
			'posts_per_page'          => $post_per_page,
			'orderby'          => 'post_date',
			'order'            => 'DESC',
			'post_status'      => 'publish',	
			);
			$query = new WP_Query($args );
			if ($query->have_posts()) :  while ($query->have_posts()) : $query->the_post(); 
					$monix_global_post = monix_get_global_post();
					$postid = $monix_global_post->ID;
					$get_image = wp_get_attachment_url( get_post_thumbnail_id($postid) ); 
					$archive_month = get_the_time('M'); 
					$archive_day   = get_the_time('d'); 
					$excerpt   = get_the_excerpt();					
				?>	
					<div <?php post_class( 'item mb-30' ); ?> id="post-<?php the_ID(); ?>">
					<?php if(!empty($get_image)){?>
                        <a href="<?php esc_url(the_permalink()); ?>">
                            <div class="post-img mb-30">
                                <div class="pub-img" style="background-image: url(<?php echo esc_url( $get_image ); ?>); background-position: center"></div>
					<?php if(monix_get_option('monix_blog_date_info') == 1){?>
					<?php if(monix_get_option('monix_blog_wp_date_format') == 1){ ?> 		
					<div class="date bg-color-2"><p><?php echo esc_attr(get_the_date()); ?></p></div><?php	
					}else{ ?>
					<div class="date bg-color-2">
                                    <span class="bold h4"><?php echo esc_attr($archive_day); ?></span>
                                    <p><?php echo esc_attr($archive_month); ?></p>
                                   </div>
						<?php } ?>						
						<?php  } ?>
                            </div>
                        </a>
					<?php } ?>	
                        <div class="post-descr">
                            <!-- Element title -->
                            <h3 class="bold mb-15"><?php esc_attr(the_title()); ?></h3>
                            <!-- Text -->
                            <p class="light thin mb-15">
					<?php if ( has_post_format( 'video' ) ) : ?>
					<?php the_content(); ?>
					<?php else: ?>
					<?php echo substr($excerpt, 0,70) ?>...
					<?php endif; ?>
							</p>
                            <!-- Link -->
                            <a class="item-link link bold" href="<?php the_permalink(); ?>"><?php if(monix_get_option('monix_categorised_blog_post_btn_label') != ''){ echo esc_attr(monix_get_option('monix_categorised_blog_post_btn_label')); } else { echo esc_html__('Read more','monix'); } ?> <i class="fas fa-chevron-right"></i></a>
                        </div>
                    </div>
					<?php endwhile; endif; ?>
					<?php wp_reset_postdata(); ?>
					
                    </div>
                </div>
            </div>
        </section>
		<div class="clearfix"></div>
        <!-- End Categorised Blog posts Section-->
<?php } ?>
<?php if(monix_get_option('monix_blog_page_subscribe_section') == 1){ ?>
        <!-- Start Subscribe Section-->
        <section class="bg-color-1 p-60-0-60 blog-newsletter-section">
            <div class="container">
                <div class="row">
                    <div class="col-12 col-md-6 text-center text-md-left">
			<div class="blog-subscribe-title">
			<?php if(monix_get_option('monix_blog_page_subscribe_title') != ''){ ?>
                <!-- Section title -->
                <h2 class="thin white mb-15 newsletter-sec-title"><?php echo wp_kses(monix_get_option('monix_blog_page_subscribe_title'),$allowed_html_array);?></h2>
			<?php } ?>	
			<?php if(monix_get_option('monix_blog_page_subscribe_description') != ''){ ?>
			<!-- Text -->
                <p class="item-text light thin white newsletter-sec-desc"><?php echo  wp_kses(monix_get_option('monix_blog_page_subscribe_description'),$allowed_html_array);?></p>
			<?php } ?>	
			</div>
                    </div>
                    <div class="col-12 col-md-6 align-self-center">
                        <!-- Email input -->
						<form  method="POST" id="newsletter">
                        <div class="input-group mb-3">
                            <input type="email" class="subscribe-input" placeholder="Email" name="email1" id="newsletter-email" required />
                            <div class="input-group-append">
                                <button class="load-more-btn c-button"><i class="fa fa-paper-plane"></i> <?php esc_html_e('Subscribe','monix'); ?></button>
                            </div>
							<img src="<?php echo get_template_directory_uri();?>/images/newsletter_loader.gif" class="newsletter-loader"alt="<?php esc_html_e('loader','monix'); ?>"/>
                        </div>
						</form>
						<div id="output"></div>	
                    </div>
                </div>
            </div>
        </section>
        <!-- End Subscribe Section-->
<!-- =-=-=-=-=-=-= Newsletter Without Loading Function =-=-=-=-=-=-= -->
<?php
	if (function_exists('monix_newsletter_without_loading')) monix_newsletter_without_loading();
?>
<!-- =-=-=-=-=-=-= Newsletter Without Loading Function End =-=-=-=-=-=-= -->
<?php } ?>
<?php if(paginate_links()) { ?>		
<!-- =-=-=-=-=-=-= Pagination Without Loading Function =-=-=-=-=-=-= -->
<?php
	if (function_exists('monix_pagination_without_loading')) monix_pagination_without_loading();
?>
<!-- =-=-=-=-=-=-= Pagination Without Loading Function End =-=-=-=-=-=-= -->
<?php } ?>		