Advertisement
Guest User

test

a guest
May 14th, 2013
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.60 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: SEARCH - Anime
  4. */
  5. get_header();
  6. ?>
  7.  
  8. <!-- Blue Arrow -->
  9. <div data-arrowpos="center" id="action_box" class="anime">
  10. <div class="container">
  11. <div class="row">
  12. <div class="span12"></div>
  13. </div>
  14. </div>
  15. </div>
  16.  
  17.  
  18.  
  19.  
  20. <section id="content" class="db-entry">
  21. <?php
  22. $post_type = 'anime';
  23. // $post_season = 'summer_2013';
  24. $post_genre = 'ALL';
  25. // $post_season = 'ALL';
  26. $post_types = 'ALL';
  27.  
  28. $post_name = '';
  29.  
  30. // if (isset($_GET['Season'])) {
  31. // $post_season = $_GET['Season'];
  32. // }
  33.  
  34. if (isset($_GET['Genre'])) {
  35. $post_genre = $_GET['Genre'];
  36. }
  37.  
  38. if (isset($_GET['Type'])) {
  39. $post_types = $_GET['Type'];
  40. }
  41.  
  42. if (isset($_GET['n'])) {
  43. $post_name = $_GET['n'];
  44. }
  45. ?>
  46.  
  47. <div class="container season-preview">
  48. <div class="row-fluid">
  49. <div class="span12">
  50. <h1>Search </h1>
  51. </div>
  52. </div>
  53. <div class="row-fluid">
  54. <form action="<?php get_site_url(); ?>" method="GET">
  55. <input type="text" name="n" />
  56. <div class="row-fluid">
  57. <div class="span12">
  58. <h3>Type </h3>
  59. </div>
  60. </div>
  61. <?php echo knoobie_build_search_checkbox('Type', 'a_types', 3); ?>
  62. <div class="row-fluid">
  63. <div class="span12">
  64. <h3>Genre </h3>
  65. </div>
  66. </div>
  67. <?php echo knoobie_build_search_checkbox('Genre', 'Genre', 8); ?>
  68. <input type="submit" value="Submit" />
  69. </form>
  70. </div>
  71. </div>
  72.  
  73. <div class="container season-preview">
  74. <div class="row-fluid">
  75. <div class="span12">
  76. <h1>Serie </h1>
  77. </div>
  78. </div>
  79. <div class="row-fluid">
  80. <?php
  81. $args = kn_anime_query_args(10, 2, $paged);
  82. // if($post_season != 'ALL'){
  83. // $seasons = kn_anime_query_build_singletax('Season', $post_season);
  84. // }
  85. // if ($name != '') {
  86. // $args = kn_anime_query_name($args, $name);
  87. // }
  88.  
  89. if ($post_types != 'ALL') {
  90. $types = kn_anime_query_build_singletax('a_types', $post_types);
  91. }
  92. if ($post_genre != 'ALL') {
  93. $genres = kn_anime_query_build_singletax('Genre', $post_genre);
  94. }
  95. $form_tax_fields = array(/* $seasons, */$types, $genres);
  96.  
  97. $args = kn_anime_query_add_multitval($args, $form_tax_fields, 'tax_query', 'AND');
  98.  
  99.  
  100. if (!isEmpty($post_name)) {
  101. $jap = kn_anime_query_build_singlemeta('originalname', $post_name);
  102. $ger = kn_anime_query_build_singlemeta('germanname', $post_name, 'LIKE');
  103. $eng = kn_anime_query_build_singlemeta('englishname', $post_name, 'LIKE');
  104.  
  105.  
  106. $form_name_fields = array($jap, $ger, $eng);
  107. // $form_name_fields = array($ger);
  108. $args = kn_anime_query_add_multitval($args, $form_name_fields, 'meta_query', 'OR');
  109. }
  110.  
  111.  
  112.  
  113.  
  114.  
  115. // $args = kn_anime_query_add_taxo($args, 'Season', $post_season);
  116. //// echo "<pre>";
  117. //// print_r($args);
  118. //// echo "</pre>";
  119. // $args = kn_anime_query_add_taxo($args, 'a_types', $post_types);
  120. //// echo "<pre>";
  121. //// print_r($args);
  122. //// echo "</pre>";
  123. // $args = kn_anime_query_add_taxo($args, 'Genre', $post_genre);
  124. // if(is_array($post_genre)){
  125. // $args = kn_anime_query_add_genre($args, false, $post_genre);
  126. // }else{
  127. // $args = kn_anime_query_add_genre($args, true, $post_genre);
  128. // }
  129. //// $args = kn_anime_query_add_genre($args, false, array('drama','advanture'));
  130. // $args = kn_anime_query_add_animetype($args, 'serie');
  131.  
  132.  
  133. echo "<pre>";
  134. print_r($args);
  135. echo "</pre>";
  136.  
  137.  
  138. // $myquery_series = new WP_Query($args);
  139. query_posts($args);
  140. if (function_exists('zn_pagination')) {
  141. zn_pagination();
  142. }
  143.  
  144. echo '<table><thead><th>#</th><th>Name</th><th>Type</th></thead><tbody>';
  145. if (have_posts()) {
  146. while (have_posts()) : the_post();
  147.  
  148. echo '<tr>';
  149. echo '<td>Nr.</td>';
  150. echo '<td>' . get_the_title() . '</td>';
  151. echo '<td>' . kn_anime_get_types() . '</td>';
  152. echo '</tr>';
  153. endwhile;
  154. } else {
  155. echo '<tr><td></td><td><p>Nothing found with</p><br>Season: ' . $post_season . '<br>Genre: ' . $post_genre . '</td><td></td></tr>';
  156. }
  157.  
  158. echo '</tbody></table>';
  159. if (function_exists('zn_pagination')) {
  160. zn_pagination();
  161. }
  162.  
  163. // wp_reset_postdata();
  164. ?>
  165. </div>
  166. </div>
  167.  
  168. </section><!-- end #content -->
  169.  
  170. <?php
  171. get_footer();
  172. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement