<?php
$sec_padding = 'p-70-40';
if(monix_get_option('monix_blog_page_breadcrumb_section') == 1){
  $sec_padding = 'p-90-55';
}
?>
<!-- Start Post -->
<section class="blog <?php echo esc_attr($sec_padding); ?> single-layout-one">
   <div class="container">
      <div class="row d-flex">
         <div class="<?php if(monix_get_option('monix_single_post_style') == 2) { echo "col-12 col-lg-9 col-md-12 col-sm-12 col-xs-12 post-text"; } else { echo "col-12 col-lg-12 post-text"; } ?>">
            <?php if (have_posts()) :  while (have_posts()) : the_post(); 
               $monix_global_post = monix_get_global_post();
               $postid = $monix_global_post->ID;
               $get_image = get_the_post_thumbnail_url($postid); 
               $archive_month = get_the_time('M'); 
               $archive_day   = get_the_time('d'); 
               $get_the_title   = get_the_title();				
               ?>	
					<div <?php post_class('blog-single-post blog-mr-10'); ?> id="post-<?php the_ID(); ?>">												
						<?php if(monix_get_option('monix_single_post_style') == 2) { ?>
							<?php if ( has_post_thumbnail() ) { ?>
								<div class="aligncenter f-image-bg">
								<?php the_post_thumbnail('f-image-class'); ?>
								</div>
							<?php } ?>
						<?php } ?>
                        <!-- Post title end -->
						<div class="single-mainpost">
						<?php if(monix_get_option('monix_single_post_style') == 1) { ?>
							<?php if ( has_post_thumbnail() ) { ?>
								<div class="featured_img_monix">
								<?php the_post_thumbnail('f-image-class'); ?>
								</div>
							<?php } ?>
						<?php } ?>
						<div class="section-title sm-ac">
						<?php if(!empty($get_the_title)) { ?> 
                            <h1><?php echo esc_attr($get_the_title) ?></h1>
						<?php } ?>	
                        </div>
						<?php if (monix_get_option('monix_blog_single_meta_tags') == 1) { ?>
							<div class="meta-option clearfix">
							<ul class="info pull-left">
								<li><i class="fas fa-user"></i><a href="<?php echo esc_url(get_the_author_posts_link() ); ?>"><?php esc_html_e('By', 'monix'); ?>  <?php the_author(); ?></a></li>
								<?php if(monix_get_option('monix_single_post_date_info') == 1){ ?>
								<li><i class="fas fa-calendar"></i><a href="<?php the_permalink(); ?>"><?php the_date(get_option('date_format')); ?></a></li>
								<?php } if(monix_get_option('monix_single_post_comment_info') == 1){ ?>
								<li><i class="fas fa-comments"></i><a href="<?php echo esc_url(get_comments_link() ); ?>"><?php echo get_comments_number(); ?> <?php esc_html_e('comments', 'monix'); ?></a></li>
								<?php } ?>
							</ul>
							<?php if (monix_get_option('monix_blog_single_tag_cats') == 1) { ?>
							<?php if(has_tag() || has_category()) { ?>
							<ul class="tags pull-right">
								<?php if(has_tag()) { ?>
								<li><i class="fas fa-bookmark"></i><?php the_tags( '', ', ' ); ?>
								</li>    
								<?php } if(has_category()) { ?>
								<li><i class="fas fa-tags"></i><?php the_category( ', ' ); ?>
								</li>
								<?php } ?>
							</ul>
							<?php } ?>
							<?php } ?>
							
							</div>
						<?php } ?>
                        <?php the_content(); ?>
						<?php
						 wp_link_pages( array(
							'before'      => '<div class="page-links page-numbers"><span class="page-links-title">' . esc_html__( 'Pages:', 'monix' ) . '</span>',
							'after'       => '</div>',
							'link_before' => '<span class="linkstyle">',
							'link_after' => '</span>',
							'pagelink'    => '%',
							'separator'   => '',
						) );
						?>
						<?php
							if(monix_get_option('monix_single_post_prev_next') == 1) {
							$prevPost = get_previous_post(true);
							$nextPost = get_next_post(true);
							if((!empty($prevPost)) || (!empty($nextPost))){
						?>
					<div class="meta-option clearfix prev_next">
                        <!--Posts Nav-->						
						<div class="posts-nav">
							<div class="clearfix">
								<?php $prevPost = get_previous_post(true);
									if($prevPost) {
										$args = array(
											'posts_per_page' => 1,
											'include' => $prevPost->ID
										);
										$prevPost = get_posts($args);
										foreach ($prevPost as $post) {
											setup_postdata($post);
								?>
								<div class="pull-left">
									<a href="<?php the_permalink(); ?>" rel="prev"><div class="prev-post"><span class="fas fa-long-arrow-alt-left noshow-max400"></span> &nbsp;&nbsp;&nbsp; <?php esc_html_e('Prev Post', 'monix'); ?></div></a>								
								</div>
								<?php
							wp_reset_postdata();
									} //end foreach
								} // end if
								 
								$nextPost = get_next_post(true);
								if($nextPost) {
									$args = array(
										'posts_per_page' => 1,
										'include' => $nextPost->ID
									);
									$nextPost = get_posts($args);
									foreach ($nextPost as $post) {
										setup_postdata($post);
							?>
								<div class="pull-right">
									<a href="<?php the_permalink(); ?>" rel="next"><div class="next-post"><?php esc_html_e('Next Post', 'monix'); ?> &nbsp;&nbsp;&nbsp; <span class="fas fa-long-arrow-alt-right noshow-max400"></span> </div></a>								
								</div>  
							<?php
							wp_reset_postdata();
									} //end foreach
								} // end if
							?>
							</div>
						</div>
                    </div>
					<?php } } ?>
						</div>
                    </div>
					
               <?php if(monix_get_option('monix_single_post_social_sharing') == 1) { ?>
				<div class="row single-tags mt-45">                	
                  <div class="col-lg-8 col-md-8 col-sm-12 nopadding">
                     <?php if(monix_get_option('monix_single_post_social_sharing') == 1 ){ ?>
                     <!-- =-=-=-=-=-=-= SOCIAL SHARING SECTION =-=-=-=-=-=-= -->
                     <?php if (function_exists('monix_social_sharing_buttons')) echo monix_social_sharing_buttons(); ?>
                     <!-- =-=-=-=-=-=-= SOCIAL SHARING SECTION END =-=-=-=-=-=-= -->	
                     <?php } ?>	
                  </div>
               </div>
			   <?php } ?>
               <?php endwhile; endif; ?>
               <div class="clearfix"></div>
               <?php if(comments_open()) { ?>		
               <div class="col-md-12 blog-single-post">
                  <?php comments_template( '', true ); ?>
               </div>
               <?php } else { ?>
				<div class="mb-35"></div>
				<?php } ?>
         </div>
         <?php if(monix_get_option('monix_single_post_style') == 2) { 
            get_sidebar(); } 
            ?>
      </div>
   </div>
</section>
<!-- End Post  -->