Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php /* Template Name: Kết quả bài viết */ ?>
- <?php get_header(); ?>
- <?php
- $key = $_GET["keyword"];
- $tim_theo = $_GET ["tim-theo"];
- $category = $_GET["chuyen-muc-2"];
- ?>
- <div class="page-sitepath clearfix">
- <div class="sitepath clearfix">
- <div class="sitepath-inner clearfix">
- <div class="sitepath-l">
- <h1><?php echo get_the_title();?></h1>
- </div>
- <div class="sitepath-r">
- <?php hrm_breadcrumbs();?>
- </div>
- </div>
- </div>
- </div>
- <div class="page-center clearfix">
- <div class="zonepage-cc clearfix">
- <div class="zonepage-ccl">
- <?php get_sidebar(); ?>
- </div>
- <div class="zonepage-ccr">
- <div class="searchform clearfix">
- <form action="<?php bloginfo( 'siteurl' ); ?>/ket-qua-tim-kiem" method = "GET">
- <ul>
- <li>
- <label class="lbl">Từ khoá :</label>
- <input type="text" placeholder="Nhập từ khóa" name = "keyword" value = "" required/>
- </li>
- <li>
- <label class="lbl">Chuyên mục :</label>
- <select name="chuyen-muc-2" id="chuyen-muc-bai-viet">
- <option value="">Chọn chuyên mục</option>
- <?php $args = array(
- 'hide_empty' => 0,
- 'taxonomy' => 'danh-muc-linh-vuc-hoat-dong',
- 'orderby' => id,
- );
- $cates = get_categories( $args );
- foreach ( $cates as $cate ) { ?>
- <option value="<?php echo $cate->slug; ?>"><?php echo $cate->name; ?></option>
- <?php } ?>
- </select>
- </li>
- <li>
- <label class="lbl">Tìm theo :</label>
- <select name="tim-theo" id="tim-theo-bai-viet">
- <option value="1">Tìm tiêu đề</option>
- <option value="2">Tìm tiêu đề + nội dung</option>
- </select>
- </li>
- <li>
- <button type = "submit">Tìm kiếm bài viết</button>
- </li>
- </ul>
- </form>
- </div>
- <div class="searchresult clearfix">
- <div class="searchresult-i clearfix">
- <ul>
- <?php
- $args = array(
- 'post_type' => 'linh-vuc-hoat-dong',
- 'posts_per_page' => -1,
- 's' => $key,
- 'tax_query' => array(
- array(
- 'taxonomy' => 'danh-muc-linh-vuc-hoat-dong',
- 'field' => 'term_slug',
- 'terms' => $category,
- 'operator' => 'IN',
- )
- )
- );
- $loop = new WP_Query( $args );
- while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
- <li>
- <a class="avatar" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
- <?php the_post_thumbnail('blog-thumbnail'); ?>
- </a>
- <h4>
- <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
- </h4>
- <h5>
- <span><?php echo get_the_date(); ?> <?php echo get_the_time(); ?></span>
- </h5>
- <p>
- <?php echo wp_trim_words( get_the_content() ,30 ,'...' ); ?>
- </p>
- <a class="viewmore" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">Xem tiếp</a>
- </li>
- <li class="sep"></li>
- <?php endwhile; ?>
- <?php wp_reset_query(); ?>
- </ul>
- </div>
- </<div> </div>
- </div>
- </div>
- </div>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement