
	<?php while ( have_posts() ) : the_post(); ?>
		<!-- listing-detail
			================================================== -->
		<section class="listing-detail">
			<div class="listing-detail__gal">
				<div class="listing-detail__title-box">
					<div class="container">
						<div class="row">
							<div class="col-sm-9">
								
								<h1 class="listing-detail__title listing-detail__title-black">
									<span><?php the_title(); ?></span>
									<?php if( function_exists('triptip_comment_rating_get_average_ratings') ){ triptip_comment_rating_get_average_ratings(get_the_ID()); }  ?>
								</h1>
								<p class="listing-detail__address">
									<?php 
										$address = get_post_meta(get_the_ID(), '_triptip_address', true);
										if($address!=''){ 
									?>
										<i class="fa fa-map-marker"></i> <?php echo esc_html($address); ?>
									<?php } ?>
									<?php 
										$range = get_post_meta(get_the_ID(), '_triptip_price_range', true);
									?>
									
									<?php triptip_price_range(); ?>
									<span class="listing-detail__description-review-numb">
										<?php comments_number( esc_html__('0 Reviews','triptip'), esc_html__('1 Review','triptip'), esc_html__('% Reviews','triptip') ); ?>
									</span>
								</p>
							</div>
							<div class="col-sm-3">
								<div class="listing-detail__buttons listing-detail__buttons-icons default-listing">
									
									<?php if( function_exists('get_simple_likes_button') ) echo get_simple_likes_button(get_the_ID());?>
									<?php echo do_shortcode('[share_button]'); ?>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>

			<div class="listing-detail__content">
				<div class="container">
					<div class="row">
						<div class="col-lg-8">
							<div class="listing-detail__content-box listing-detail__content-box-nopadding">

								<div class="listing-detail__scroll-menu-box scroller-menu">
									<ul class="listing-detail__scroll-menu listing-detail__menu-top-border navigate-section">
										<li>
											<a class="active" href="#overview-box"><?php esc_html_e('Overview','triptip'); ?></a>
										</li>
										<li>
											<a href="#tips-reviews-box"><?php esc_html_e('Tips and Reviews','triptip'); ?></a>
										</li>
										<li>
											<a href="#photos-box"><?php esc_html_e('Photos','triptip'); ?></a>
										</li>
									</ul>
								</div>
								<?php 
								    $gallery = get_post_meta(get_the_ID(), '_triptip_gallery', true);
								?>
								<?php if(is_array($gallery) and $gallery!=''){ ?>
								<!-- overview box -->
								<div class="listing-detail__galleria">
									<?php $i=0; foreach($gallery as $img) { ?>
										<?php if($i<=2){ ?>
										<div class="item-image<?php if($i>0){ ?> small-size<?php } ?>">
											<a href="<?php echo esc_url($img); ?>" class="zoom">
												<img src="<?php echo esc_url($img); ?>" alt="<?php the_title_attribute(); ?>" class="img-responsive"/>
											</a>
										</div>
										<?php } ?>
									<?php $i++; } ?>
									<a href="#photos-box" class="navigate-btn"><i class="la la-camera"></i><?php esc_html_e('View all photos', 'triptip'); ?> (<?php echo  esc_html($i); ?>)</a>
								</div>
								<?php } ?>
								<!-- overview box -->
								<div class="listing-detail__overview element-waypoint" id="overview-box">
									<h2 class="heading2 listing-detail__content-title"><?php esc_html_e('Overview', 'triptip'); ?></h2>
									<div class="listing-detail__content-description">
										<?php the_content(); ?>
									</div>
								</div>

								<?php if ( comments_open() || get_comments_number() ) {  ?>
					                <?php comments_template(); ?>   
					            <?php } ?>

								<?php 
								    $gallery = get_post_meta(get_the_ID(), '_triptip_gallery', true);
								?>
								<?php if(is_array($gallery) and $gallery!=''){ ?>
								<!-- gallery-box -->
								<div class="listing-detail__photos element-waypoint" id="photos-box">
									<h2 class="heading2 listing-detail__content-title"><?php esc_html_e('Photos','triptip'); ?></h2>
									<div class="listing-detail__photos-inner iso-call" data-item-showen="6">
										<?php $j=0; foreach($gallery as $id => $url) {?>
										<?php $img = wp_get_attachment_image_src($id, 'triptip-thumb'); ?>
										<?php $img_full = wp_get_attachment_image_src($id, ''); ?>
										<div class="item">
											<a href="<?php echo esc_url($img_full[0]); ?>" class="zoom">
												<img src="<?php echo esc_url($img[0]); ?>" alt="<?php the_title_attribute(); ?>" class="img-responsive"/>
											</a>
										</div>
										<?php $j++; } ?>
										
									</div>
									<a href="#" 
										class="load-others" 
										data-less-text="View Less Photos"
										data-more-text="View all Photos"
										data-parent-class="listing-detail__photos-inner">
										<i class="la la-camera"></i>
										<span><?php esc_html_e('View all photos', 'triptip'); ?> (<?php echo esc_html($j); ?>)</span>
									</a>
								</div>
								<?php } ?>
							</div>
						</div>
						<div class="col-lg-4">
							<div class="sidebar">
								<?php $brand = get_post_meta(get_the_ID(), '_triptip_brand', true); ?>
								<?php if($brand!=''){ ?>
									<div class="sidebar__map-widget">
										<h2 class="heading2 sidebar__widget-title">
											<?php esc_html_e('Logo Brand', 'triptip'); ?>
										</h2>
										<img class="logo-brand" src="<?php echo esc_url($brand); ?>" alt="<?php the_title_attribute();?>">
									</div>
								<?php } ?>
								<div class="sidebar__map-widget">
									<?php 
										$latitude = get_post_meta(get_the_ID(), '_triptip_latitude', true);
										$longitude = get_post_meta(get_the_ID(), '_triptip_longitude', true);
										$icon = get_post_meta(get_the_ID(), '_triptip_mapicon', true);
									?>
									<?php if($longitude!='' and $latitude!=''){ ?>
										<h2 class="heading2 sidebar__widget-title">
											<?php esc_html_e('Location', 'triptip'); ?>
										</h2>
										<div id="mapSingle" data-latitude="<?php echo esc_attr($latitude); ?>" data-longitude="<?php echo esc_attr($longitude); ?>" data-map-icon="<?php echo esc_attr($icon); ?>"></div>
									<?php } ?>
								</div>

								<div class="sidebar__widget sidebar__widget-listing-details">
									<h2 class="heading2 sidebar__widget-title">
										<?php esc_html_e('Details', 'triptip'); ?>
									</h2>
									<ul class="sidebar__listing-list">
										<li>
											<?php 
											if($address!=''){ ?>
												<i class="la la-map-marker"></i>
												<?php echo esc_html($address); ?>
											<?php } ?>
										</li>
										<?php $phone = get_post_meta(get_the_ID(), '_triptip_phone', true); ?>
										<?php if($phone!=''){ ?>
											<li>
												<i class="la la-mobile-phone"></i>
												<a href="tel:<?php echo esc_attr($phone); ?>"><?php echo esc_html($phone); ?></a>
											</li>
										<?php } ?>
										<?php $email = get_post_meta(get_the_ID(), '_triptip_email', true); ?>
										<?php if($email!=''){ ?>
											<li>
												<i class="la la-envelope-o"></i>
												<a href="mailto:<?php echo esc_attr($email); ?>"><?php echo esc_html($email); ?></a>
											</li>
										<?php } ?>
										<?php $website = get_post_meta(get_the_ID(), '_triptip_website', true); ?>
										<?php if($website!=''){ ?>
											<li>
												<i class="la la-link"></i>
												<a href="<?php echo esc_url($website); ?>" target="_blank"><?php echo esc_html($website); ?></a>
											</li>
										<?php } ?>
										<?php $custom_meta = get_post_meta( get_the_ID(), 'custom_meta', true ); ?>
										<?php if($custom_meta!=null){ ?>
											<?php 
												$i=1; foreach ( (array) $custom_meta as $key => $entry ) { ?>
												<li>
													<?php if($entry['icon']!=''){ ?>
														<i class="<?php echo esc_attr($entry['icon']); ?>"></i>
													<?php } ?>
													<?php echo esc_html($entry['title']); ?>: <?php echo esc_html($entry['value']); ?>
												</li>
											<?php $i++; }?>
										<?php } ?>
									</ul>
									<?php if( function_exists('qkl_business_hours') ){ qkl_business_hours(); } ?>
								</div>
								<?php if(qkl_get_setting('author_block')!='off'){ ?>
									<div class="sidebar__widget sidebar__widget-author">
										<h2 class="heading2 sidebar__widget-title">
											<?php esc_html_e('Author', 'triptip'); ?>
										</h2>
										
										<!-- Author-wrapper module -->
										<div class="author-wrapper">
											<div class="author-wrapper__profile">
												<div class="row">
													<div class="col-7">
														<div class="author-wrapper__content">
															<a class="author-wrapper__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-wrapper__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-wrapper__location">
																		<?php echo get_user_meta(get_the_author_meta('ID'), '_triptip_user_address' ,true); ?>
																	</span>
																<?php } ?>
															</h3>
														</div>
													</div>
													
												</div>
											</div>
											<ul class="author-wrapper__list">
												<li>
													<span><?php echo count_user_posts( get_the_author_meta( 'ID' ) , 'listing' ); ?></span>
													<?php esc_html_e('Listing', 'triptip'); ?>
												</li>
												
												<li>
													<span><?php echo count_user_posts( get_the_author_meta( 'ID' ) ); ?></span>
													<?php esc_html_e('Posts', 'triptip'); ?>
												</li>
												<?php  if( function_exists('qkl_comment_count') ){ ?>
													<li>
														<span><?php  qkl_comment_count(); ?></span>
														<?php esc_html_e('Reviews', 'triptip'); ?>
													</li>
												<?php } ?>
											</ul>
										</div>
										<!-- End Author-wrapper module-->
									</div>
								<?php } ?>
								<div class="sidebar__widget sidebar__widget-tags">
									<h2 class="heading2 sidebar__widget-title">
										<?php esc_html_e('Listing Tags', 'triptip'); ?>
									</h2>
									<?php 
										$tags = wp_get_post_terms( get_the_ID(), 'listing-tag' ); 
									?>
									<?php if($tags){ ?>
										<ul class="sidebar__tags-list">
											<?php foreach($tags as $tag){ ?>
												<li><a href="<?php echo get_term_link($tag->slug, 'listing-tag'); ?>"><?php echo esc_html($tag->name); ?></a></li>
											<?php } ?>
										</ul>
									<?php } ?>
								</div>

								<?php 
									if(is_active_sidebar('sidebar-list')){
										dynamic_sidebar('sidebar-list');
									}
								?>

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

		</section>
		<!-- End listing-detail -->
	<?php endwhile; ?>