<?php get_header(); ?>

<div class="clearfix"></div>

<!-- Page Content Section -->
<main id="content">
  <div class="container">
    <div class="row">
      <div class="<?php echo is_active_sidebar('sidebar-1') ? 'col-lg-9 col-md-9' : 'col-lg-12 col-md-12'; ?>">
        <div class="Single-Content-container">
          <div class="row">
            <?php while(have_posts()) : the_post(); ?>
              <div class="col-lg-12">
                <div class="TL-blog-post-box">
                  <h1 class="Post-title-head"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
                  <article class="Small">
                    <div class="TL-blog-category Post-meta-data">
                      <i class="fa fa-user Meta-fa-icon-user"></i>
                      <a class="Meta-user-des" href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID'))); ?>">
                        <?php the_author(); ?>
                      </a>
                      <i class="fa fa-calendar Meta-fa-icons"></i>
                      <span class="Meta-data-date"><?php echo get_the_date(); ?></span>
                    </div>
                    <a class="TL-blog-thumb">
                      <?php if(has_post_thumbnail()): ?>
                        <?php the_post_thumbnail('', array('class' => "img-responsive")); ?>
                      <?php endif; ?>
                    </a>
                    <div class="Category-tag-div">
                      <?php the_category(', '); ?>
                    </div>
                    <?php the_content(); ?>
                    <div class="Category-tag-div">
                      <?php the_tags('<i class="fa fa-tag" aria-hidden="true"></i> ', ', ', '<br />'); ?>
                    </div>
                    <?php wp_link_pages(array('before' => '<div class="link Single-post-link">', 'after' => '</div>')); ?>
                  </article>
                </div>
              </div>

              <div class="col-lg-12">
                <!-- Author Info Block -->
                <div class="media TL-info-author-block">
                  <a href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID'))); ?>" class="TL-author-pic">
                    <?php echo get_avatar(get_the_author_meta('ID'), 150); ?>
                  </a>
                  <div class="media-body">
                    <h4 class="media-heading"><?php esc_html_e('About', 'techlauncher'); ?>: <a href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID'))); ?>"><?php the_author(); ?></a></h4>
                    <p><?php echo esc_html( get_the_author_meta('description') ); ?></p>
                    <div class="row">
                      <div class="col-lg-6">
                        <ul class="list-inline info-author-social">
                          <?php techlauncher_social_links(); // A custom function to display social links ?>
                        </ul>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            <?php endwhile; ?>

            <!-- Single Navigation -->
            <div class="col-lg-12">
              <div class="single-post-links">
                <div class="single-previous-post">
                  <div class="col-md-6">
                    <div class="previous-link">
                      <?php next_post_link('<h5><span class="post-arrow">&laquo;</span> %link</h5>'); ?>
                    </div>
                  </div>
                </div>
                <div class="single-next-post">
                  <div class="col-md-6">
                    <div class="next-link">
                      <?php previous_post_link('<h5>%link <span class="post-arrow">&raquo;</span></h5>'); ?>
                    </div>
                  </div>
                </div>
                <div class="clearfix"></div>
              </div>
            </div>
            <!-- Single Navigation END -->

            <?php if(get_comments_number() > 0) comments_template('', true); ?>
          </div>
        </div>
      </div>

      <div class="col-lg-3 col-md-3">
        <?php get_sidebar(); ?>
      </div>
    </div>
    <!-- Row end -->
  </div>
</main>

<?php get_footer(); ?>
