Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.80 KB | None | 0 0
  1. <?php /* Template Name: Kết quả bài viết */ ?>
  2. <?php get_header(); ?>
  3.  
  4.  
  5. <?php
  6. $key = $_GET["keyword"];
  7.  
  8. $tim_theo = $_GET ["tim-theo"];
  9. $category = $_GET["chuyen-muc-2"];
  10. ?>
  11. <div class="page-sitepath clearfix">
  12. <div class="sitepath clearfix">
  13. <div class="sitepath-inner clearfix">
  14. <div class="sitepath-l">
  15. <h1><?php echo get_the_title();?></h1>
  16.  
  17. </div>
  18. <div class="sitepath-r">
  19. <?php hrm_breadcrumbs();?>
  20. </div>
  21. </div>
  22. </div>
  23.  
  24. </div>
  25.  
  26. <div class="page-center clearfix">
  27. <div class="zonepage-cc clearfix">
  28. <div class="zonepage-ccl">
  29. <?php get_sidebar(); ?>
  30. </div>
  31. <div class="zonepage-ccr">
  32. <div class="searchform clearfix">
  33. <form action="<?php bloginfo( 'siteurl' ); ?>/ket-qua-tim-kiem" method = "GET">
  34. <ul>
  35. <li>
  36.  
  37. <label class="lbl">Từ khoá :</label>
  38. <input type="text" placeholder="Nhập từ khóa" name = "keyword" value = "" required/>
  39. </li>
  40.  
  41. <li>
  42. <label class="lbl">Chuyên mục :</label>
  43. <select name="chuyen-muc-2" id="chuyen-muc-bai-viet">
  44. <option value="">Chọn chuyên mục</option>
  45. <?php $args = array(
  46. 'hide_empty' => 0,
  47. 'taxonomy' => 'danh-muc-linh-vuc-hoat-dong',
  48. 'orderby' => id,
  49. );
  50. $cates = get_categories( $args );
  51. foreach ( $cates as $cate ) { ?>
  52. <option value="<?php echo $cate->slug; ?>"><?php echo $cate->name; ?></option>
  53. <?php } ?>
  54. </select>
  55. </li>
  56. <li>
  57. <label class="lbl">Tìm theo :</label>
  58. <select name="tim-theo" id="tim-theo-bai-viet">
  59. <option value="1">Tìm tiêu đề</option>
  60. <option value="2">Tìm tiêu đề + nội dung</option>
  61. </select>
  62. </li>
  63. <li>
  64. <button type = "submit">Tìm kiếm bài viết</button>
  65. </li>
  66. </ul>
  67. </form>
  68. </div>
  69. <div class="searchresult clearfix">
  70.  
  71.  
  72. <div class="searchresult-i clearfix">
  73.  
  74.  
  75.  
  76. <ul>
  77. <?php
  78. $args = array(
  79. 'post_type' => 'linh-vuc-hoat-dong',
  80. 'posts_per_page' => -1,
  81. 's' => $key,
  82. 'tax_query' => array(
  83. array(
  84. 'taxonomy' => 'danh-muc-linh-vuc-hoat-dong',
  85. 'field' => 'term_slug',
  86. 'terms' => $category,
  87. 'operator' => 'IN',
  88. )
  89. )
  90. );
  91. $loop = new WP_Query( $args );
  92.  
  93. while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
  94.  
  95. <li>
  96. <a class="avatar" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
  97. <?php the_post_thumbnail('blog-thumbnail'); ?>
  98. </a>
  99. <h4>
  100. <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
  101. </h4>
  102. <h5>
  103. <span><?php echo get_the_date(); ?> <?php echo get_the_time(); ?></span>
  104. </h5>
  105. <p>
  106. <?php echo wp_trim_words( get_the_content() ,30 ,'...' ); ?>
  107. </p>
  108.  
  109. <a class="viewmore" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">Xem tiếp</a>
  110. </li>
  111.  
  112. <li class="sep"></li>
  113.  
  114.  
  115. <?php endwhile; ?>
  116. <?php wp_reset_query(); ?>
  117. </ul>
  118.  
  119. </div>
  120. </<div> </div>
  121. </div>
  122. </div>
  123. </div>
  124. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement