<?php
/**
 * The blog template file.
 *
 * @package flatsome
 */

get_header();
	$term = $wp_query->get_queried_object();
	$catid = $term->term_id;
	$post_type = $wp_query->query['post_type'];
	if(!empty($post_type == "library-post")){
		?>
		
		<?php
	}else{
		?>
		<div id="content" class="blog-wrapper blog-archive page-wrapper">
			<div class="sb_block_ar row category-page-row">
				<div class="sb_full">
					<div class="search-new-list">
						<h1 class="heading" style="padding:15px;"><span>Kết quả tìm kiếm: <?php echo get_query_var('s'); ?></span></h1>
						<div style="padding: 0 15px;">
						<?php 
							if(have_posts()) {
					        while(have_posts()){
					        the_post();
	                    	?>
	                    		<div class="new-list-post">
									<div>
										<div class="post-image">
											<a href="<?php the_permalink();?>" title="<?php the_title();?>">
									            <?php if(has_post_thumbnail()) the_post_thumbnail("full",array("alt" => get_the_title()));
									            else echo "No Image"; ?>
									        </a>
										</div>
										<div class="post-content">
											<a class="cate" href="<?php echo get_category_link($catid); ?>"><?php echo get_cat_name($catid); ?></a>
											<h2><a class="title" href="<?php the_permalink();?>" title="<?php the_title();?>"><?php echo the_title();?></a></h2>
											<div class="excerpt">
												<?php echo the_excerpt(); ?>
											</div>
											<div class="orenda_timer3">
												<span><i class="fa-regular fa-clock"></i> <?php the_time('d/m/Y'); ?> </span>
												<span><i class="fa-regular fa-eye"></i> <?php echo getPostViews(get_the_ID()); ?></span>
											</div>
										</div>
									</div>
								</div>
	                    	<?php
							}//End while
						    }else{
						    	?>
						    	<p style="padding: 0 15px;">Không tìm thấy bài viết phù hợp với kết quả tìm kiếm của bạn</p>
						    	<?php
						    }

						?>
						</div>
						<?php 
							wp_reset_postdata();
							flatsome_posts_pagination();
						?>
					</div>
						
				</div>
			</div>
		</div>
		<?php
	}	
?>

	

<?php 
	get_footer(); ?>
	
