<?php
/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @package AttorneyPress
 */

get_header();
?>

<div id="primary" class="content-area">
	<main id="main" class="site-main">
		<!-- wraper_blog_main -->
		<section class="wraper_blog_main">
			<div class="container">
				<!-- row -->
				<div class="row">
					<?php if ( attorneypress_global_var( 'blog-layout','',false ) ) : ?>
						<?php if ( 'leftsidebar' === attorneypress_global_var( 'blog-layout','',false ) ) { ?>
							<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 left-sidebar">
								<?php get_sidebar(); ?>
							</div>
						<?php } ?>
						<?php if ( 'nosidebar' === attorneypress_global_var( 'blog-layout','',false ) ) { ?>
							<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
						<?php } else { ?>
							<div class="col-lg-8 col-md-8 col-sm-8 col-xs-12">
						<?php } ?>
								<!-- blog_single -->
								<?php if ( 'leftsidebar' === attorneypress_global_var( 'blog-layout','',false ) ) { ?>
									<div class="blog_single left-sidebar">
								<?php } elseif ( 'rightsidebar' === attorneypress_global_var( 'blog-layout','',false ) ) { ?>
									<div class="blog_single right-sidebar">
								<?php } else { ?>
									<div class="blog_single">
								<?php } ?>
										<?php
										while ( have_posts() ) :
											the_post();
											get_template_part( 'template-parts/content-single', get_post_format() );
											endwhile; // End of the loop.
										?>
											<!-- post-navigation -->
											<?php
											the_post_navigation(
												array(
													'prev_text'  => esc_html__( 'Previous Post', 'attorneypress' ),
													'next_text'  => esc_html__( 'Next Post', 'attorneypress' ),
												)
											);
											?>
											<!-- post-navigation -->
											<?php if ( get_the_author_meta( 'description' ) ) : ?>
											<!-- author-bio -->
											<div class="author-bio">
												<div class="holder">
													<div class="pic">
														<?php echo get_avatar( get_the_author_meta( 'email' ), '90' ); ?>
													</div>
													<div class="data">
														<h5><?php the_author_link(); ?></h5>
														<p><?php the_author_meta( 'description' ); ?></p>
													</div>
												</div>
											</div>
											<!-- author-bio -->
											<?php endif; ?>
											<!-- comments-area -->
											<?php if ( attorneypress_global_var( 'blog_comment_display','',false ) ) : ?>
												<?php if ( comments_open() || get_comments_number() ) : ?>
													<?php comments_template(); ?>
												<?php endif; ?>
											<?php endif; ?>
											<!-- comments-area -->
										</div>
										<!-- blog_single -->
									</div>
									<?php if ( 'rightsidebar' === attorneypress_global_var( 'blog-layout','',false ) ) { ?>
										<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 right-sidebar">
											<?php get_sidebar(); ?>
										</div>
									<?php } ?>
					<?php else : ?>
						<div class="col-lg-8 col-md-8 col-sm-8 col-xs-12">
							<?php
							while ( have_posts() ) :
								the_post();
								get_template_part( 'template-parts/content-single', get_post_format() );
											endwhile; // End of the loop.
										?>
											<!-- post-navigation -->
											<?php
											the_post_navigation(
												array(
													'prev_text'  => esc_html__( 'Previous Post', 'attorneypress' ),
													'next_text'  => esc_html__( 'Next Post', 'attorneypress' ),
												)
											);
											?>
											<!-- post-navigation -->
											<?php
											$authordesc = get_the_author_meta( 'description' );
											if ( ! empty( $authordesc ) ) {
											?>
											<!-- author-bio -->
											<div class="author-bio">
												<div class="holder">
													<div class="pic">
														<?php echo get_avatar( get_the_author_meta( 'email' ), '90' ); ?>
													</div>
													<div class="data">
														<h5><?php the_author_link(); ?></h5>
														<p><?php the_author_meta( 'description' ); ?></p>
													</div>
												</div>
											</div>
											<!-- author-bio -->
<?php
											}
?>
											<!-- comments-area -->
											<?php if ( comments_open() || get_comments_number() ) : ?>
													<?php comments_template(); ?>
												<?php endif; ?>
											<!-- comments-area -->
						</div>
						<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 right-sidebar">
							<?php get_sidebar(); ?>
						</div>
					<?php endif; ?>
				</div>
				<!-- row -->
			</div>
		</section>
		<!-- wraper_blog_main -->
	</main><!-- #main -->
</div><!-- #primary -->
<?php
get_footer();
