Advertisement
Guest User

Untitled

a guest
Jan 21st, 2016
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. <div class="search-form">
  2. <?php $category = get_the_category(); ?>
  3. <form action="http://localhost/allwpthemesv4/" id="custom-search-form" class="form-search form-horizontal pull-right" method="get">
  4. <div class="input-append span12">
  5. <input type="text" class="search-query" name="s" id="s" value="<?php the_search_query(); ?>" placeholder="Search..">
  6. <?php if (is_category(32)) { ?>
  7. <input type="hidden" name="cat" value="32" />
  8. <?php } elseif (is_category(33)) { ?>
  9. <input type="hidden" name="cat" value="33" />
  10. <?php } ?>
  11. <button type="submit" class="btn"><span class="glyphicon glyphicon-search"></span></button>
  12. </div>
  13. </form>
  14. </div>
  15.  
  16. <?php
  17. $cat = get_category( get_query_var( 'cat' ) );
  18. $cat_name = $cat->name;
  19.  
  20. $exclude_catid = 68; //the cat id to exclude
  21. if($orderby === "add_date") {
  22. $movies = new WP_Query(
  23. array(
  24. "post_type" => "post",
  25. "showposts" => -1,
  26. "category_name" => $cat_name,
  27. "order" => $order,
  28. "category__not_in" => array($exclude_catid),
  29. "tag" => $tags
  30. )
  31. );
  32. }
  33. elseif($orderby === "year") {
  34. $movies = new WP_Query(
  35. array(
  36. "post_type" => "post",
  37. "orderby" => "meta_value_num",
  38. "meta_key" => "year",
  39. "order" => $order,
  40. "category_name" => $cat_name,
  41. "showposts" => -1,
  42. "category__not_in" => array($exclude_catid)
  43. )
  44. );
  45. }
  46. elseif($orderby === "rating") {
  47. $movies = new WP_Query(
  48. array(
  49. "post_type" => "post",
  50. "orderby" => "meta_value_num",
  51. "meta_key" => "rating",
  52. "order" => $order,
  53. "category_name" => $cat_name,
  54. "showposts" => -1,
  55. "category__not_in" => array($exclude_catid)
  56. )
  57. );
  58. }
  59. ?>
  60. <?php if ($movies->have_posts()) : ?>
  61.  
  62. <?php while ($movies->have_posts()) : $movies->the_post(); ?>
  63.  
  64. <--- MY CONTENT HERE --->
  65.  
  66. <?php endwhile; ?>
  67.  
  68. <?php else : ?>
  69. <h4 class="text-center">Not Found</h4>
  70. <p class="text-center">Sorry, but you are looking for something that isn't here.</p>
  71. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement