<?php get_header(); ?>
<div class="container-fluid-blog main-content-wrap" role="mains-1">
  <ul class="breadcrumb">
<?php display_bc($category->category_parent); ?>
    <?php display_bc(1); ?>
  </ul>
<?php $single_style = get_theme_mod('blog_single_style', 'single_fancy');?>
<?php if ( $single_style == 'single_fancy' ): ?>
         <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
               <?php $backgroundImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); ?>
                                    <div class="header page-title post-header" style="background: url('<?php echo $backgroundImg[0]; ?>') no-repeat; ">
                                        <div class="headerCentered">
                                            <div class="cat-label"><?php $categories = get_the_category();
                                                if ( ! empty( $categories ) ) {
                                                    echo '<a href="' . esc_url( get_category_link( $categories[0]->term_id ) ) . '">' . esc_html( $categories[0]->name ) . '</a>';
                                                } ?>
                                            </div>
                                            <h2 data-role="page-title"><?php the_title(); ?></h2>
                                            <span class="page-author">Written by <?php the_author(); ?></span>
                                        </div>
                                   </div>        

</div>

<div class="blog-content-area">    
	<div class="container-blog ">
		<div class="row">
			<div class="col-md-12 col-lg-12">
				<section id="content">
					<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
					<section class="entry-content">
					<div class="page-content">
					<?php the_content(); ?>
					</div>
					</section>
					</article>
				</section>
			</div>
		</div>
	</div>   
</div>

<?php endwhile; endif; ?>

    <div class="container-fluid container-fluid-blog blog-direction-post-container">
        <div class="col-lg-5 blog-direction-post">
            PREVIOUS ARTICLE 
            <div class="previous-next-link">
                <?php previous_post_link('%link', '&#8592; %title'); ?>                    
            </div>
        </div>
        <?php
            $the_cat = get_the_category();
            $category_name = $the_cat[0]->cat_name;
            $category_link = get_category_link( $the_cat[0]->cat_ID );
        ?>
        <div class="col-lg-2 visible-lg visible-md">
            <a aria-label="Category Home Page" href="<?= $category_link ?>" class="blog-home"><span class="hidden">Home</span></a>
        </div>
        <div class="col-lg-5 blog-direction-post blog-direction-post-right">
            NEXT ARTICLE
            <div class="previous-next-link">
                <?php next_post_link('%link', '%title &#8594;'); ?>                        
            </div>
        </div>
    </div>
	<!-- <div class="container blog-similar-posts">
        <?php echo do_shortcode('[display-posts wrapper="div" wrapper_class="related-posts-wrap" include_date="true" include_author="true" image_size="thumbnail"]') ?>
    </div> -->
<!-- -----------------SINGLE Simple -->
  <?php elseif ( $single_style == 'single_simple') : ?>
		<!-- BEGIN BLOG SINGLE  -->
<div class="blog-simple">
	<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="blog-content-area">    
	<div class="container-blog ">
		<div class="row">
			<div class="col-md-12 col-lg-12">
				<section id="content">
					
					<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
						<section class="entry-content">
						<div class="page-content">
						<div class="blog-text">
							<div class="blog-title"><a href="<?php the_permalink(); ?>">
							<?php the_title( '<h2>', '</h2>' ); ?>
							</a></div>
							<div class="blog-meta"><span class="blog-meta-left">Posted on <strong>
							<?php the_time('F j, Y'); ?>
							</strong> | </span> <span class="blog-meta-right"><em>by</em>
							<?php the_author_posts_link(); ?>
							<em>in </em>
							<?php the_category(', ') ?>
							</span> </div>
						</div>
					<?php the_content(); ?>
					</div>
					</section>
					</article>
				</section>
			</div>
		</div>
	</div>   
</div>

<?php endwhile; endif; ?>

    <div class="container-fluid container-fluid-blog blog-direction-post-container">
        <div class="col-lg-5 blog-direction-post">
            PREVIOUS ARTICLE 
            <div class="previous-next-link">
                <?php previous_post_link('%link', '&#8592; %title'); ?>                    
            </div>
        </div>
        <?php
            $the_cat = get_the_category();
            $category_name = $the_cat[0]->cat_name;
            $category_link = get_category_link( $the_cat[0]->cat_ID );
        ?>
        <div class="col-lg-2 visible-lg visible-md">
            <a aria-label="Category Home Page" href="<?= $category_link ?>" class="blog-home"><span class="hidden">Home</span></a>
        </div>
        <div class="col-lg-5 blog-direction-post blog-direction-post-right">
            NEXT ARTICLE
            <div class="previous-next-link">
                <?php next_post_link('%link', '%title &#8594;'); ?>                        
            </div>
        </div>
    </div>
	<!-- <div class="container blog-similar-posts">
        <?php echo do_shortcode('[display-posts wrapper="div" wrapper_class="related-posts-wrap" include_date="true" include_author="true" image_size="thumbnail"]') ?>
    </div> -->
</div>
<!-- END BLOG SINGLE  -->

  <?php else : ?>
  Not Found
  <?php endif; ?>
	
</div>

<?php get_footer(); ?>