
<?php while ( have_posts() ) : the_post(); ?>

<!-- page-title-module
	================================================== -->
<section class="page-title">
	<div class="container">
		<h1 class="page-title__title"><?php the_title(); ?></h1>
		<ul class="single-post__list">
			<li class="single-post__list-item">
				<i class="la la-calendar-check-o"></i>
				<span><?php the_time(get_option( 'date_format' )); ?></span>
			</li>
			<li class="single-post__list-item">
				<i class="la la-comments"></i>
				<?php
                    comments_popup_link( esc_html__('0 Comments','triptip'), esc_html__('1 Comment','triptip'), esc_html__('% Comments','triptip'), '',  esc_html__('Comment off','triptip'));
                ?>
			</li>
		</ul>
	</div>
</section>
<!-- End page-title-module -->

<!-- blog-page-section 
	================================================== -->
<section class="blog-page">
	<div class="container">
		<div class="blog-page-box">
			<div class="row">
				<?php if(is_active_sidebar('sidebar-1')){ ?>
	            <div class="col-md-8">
	            <?php }else{ ?>
	            <div class="col-md-12">
	            <?php } ?>
					<div class="blog-page__box">
						<div class="single-post">
							<?php $post_banner = get_post_meta($wp_query->get_queried_object_id(), '_triptip_page_banner', true) ?>
							<?php if($post_banner!=''){ ?>
								<img class="single-post__image" src="<?php echo esc_url($post_banner); ?>" alt="<?php the_title_attribute(); ?>">
							<?php }elseif(has_post_thumbnail()){ ?>
								<?php the_post_thumbnail('', ['class' => 'single-post__image']); ?>
							<?php } ?>
							<div class="single-content">					
							<?php the_content(); ?>
			                  <?php
			                    $defaults = array(
			                      'before'           => '<div id="page-links"><strong>'.esc_html__('Page','triptip').': </strong>',
			                      'after'            => '</div>',
			                      'link_before'      => '<span>',
			                      'link_after'       => '</span>',
			                      'next_or_number'   => 'number',
			                      'separator'        => ' ',
			                      'nextpagelink'     => esc_html__( 'Next page','triptip' ),
			                      'previouspagelink' => esc_html__( 'Previous page','triptip' ),
			                      'pagelink'         => '%',
			                      'echo'             => 1
			                    );
			                   ?>
			                  
			              </div>
			              <?php wp_link_pages($defaults); ?>
			              <?php if(has_tag()){ ?>
								
			              		<div class="row">
									<div class="col-md-6">
										<p class="single-post__tags">
											<i class="la la-tag"></i>
											<?php the_tags( '', ', ', '' ); ?>
										</p>
									</div>
									<div class="col-md-6">
										
									</div>
								</div>

							<?php } ?>
							<?php if(get_theme_mod('post_author',false)==true){ ?>
								<h3 class="heading3 single-post__line-title">
									<?php esc_html_e('Author', 'triptip'); ?>
								</h3>

								<!-- author post box -->
								<div class="author-post-box">
									<div class="row">
										<div class="col-sm-6">
											<div class="author-post-box__content">
												<a class="author-post-box__image" href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ); ?>">
													<?php if(get_user_meta(get_the_author_meta('ID'), '_triptip_avatar' ,true)!=''){ ?>
											            <?php $image = get_user_meta(get_the_author_meta('ID'), '_triptip_avatar' ,true); ?>
											            <img src="<?php echo esc_url($image); ?>" />
											        <?php }else{ ?>
											          <?php echo get_avatar(get_the_author_meta('user_email'),$size='100',$default='https://0.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=120' ); ?>
											        <?php } ?>
												</a>
												<h3 class="heading3 author-post-box__title">
													<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ); ?>"><?php echo esc_html(get_the_author_meta('display_name'));?></a>
													<?php if(get_user_meta(get_the_author_meta('ID'), '_triptip_user_address' ,true)!=''){ ?>
														<span class="author-post-box__location">
															<?php echo get_user_meta(get_the_author_meta('ID'), '_triptip_user_address' ,true); ?>
														</span>
													<?php } ?>
												</h3>
											</div>
										</div>
										<div class="col-sm-6">
											
										</div>
									</div>
								</div>								
								<!-- end author post box -->
							<?php } ?>
							<?php if(get_theme_mod('post_navi',false)==true){ ?>
				              	<?php

					              $prev_post = get_adjacent_post(false, '', true);
					              $next_post = get_adjacent_post(false, '', false); 
					              
					            ?>
					            <?php if($prev_post!=null or $next_post!=null){ ?>
									<div class="other-posts">
										
										<?php if($prev_post!=null){ ?>
											<?php 
												$title = $prev_post->post_title;
												$n_title  = strlen ($title ); 
												if($n_title>50){ 
													$sub_title = substr($title, 0, 25).'...';
												}else{
													$sub_title = $title;
												}
											?>
											<a href="<?php echo esc_url(get_permalink($prev_post->ID)); ?>" class="other-posts__prev">
												<i class="la la-angle-left"></i>
												<div class="other-posts__prev-box">
													<span class="other-posts__desc"><?php esc_html_e('Previous Post', 'triptip'); ?></span>
													<h2 class="heading2 other-posts__title">
														<?php echo esc_attr($sub_title); ?>
													</h2>
												</div>
											</a>
										<?php } ?>
										<?php if($next_post!=null){ ?>
											<?php 
												$title = $next_post->post_title;
												$n_title  = strlen ($title ); 
												if($n_title>50){ 
													$sub_title = substr($title, 0, 25).'...';
												}else{
													$sub_title = $title;
												}
											?>
											<a href="<?php echo esc_url(get_permalink($next_post->ID)); ?>" class="other-posts__next">
												<i class="la la-angle-right"></i>
												<div class="other-posts__next-box">
													<span class="other-posts__desc"><?php esc_html_e('Next Post', 'triptip'); ?></span>
													<h2 class="heading2 other-posts__title">
														<?php echo esc_attr($sub_title); ?>
													</h2>
												</div>
											</a>
										<?php } ?>
											
									</div>
								<?php } ?>
							<?php } ?>
							<?php if ( comments_open() || get_comments_number() ) {  ?>
				                <?php comments_template(); ?>   
				            <?php } ?>
							

						</div>
					</div>
				</div>

				<div class="col-md-4">
	                <?php get_sidebar(); ?>
	            </div>
	            
			</div>
		</div>
	</div>
</section>
<!-- End news section -->


<?php endwhile; ?>