Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Template Name: SEARCH - Anime
- */
- get_header();
- ?>
- <!-- Blue Arrow -->
- <div data-arrowpos="center" id="action_box" class="anime">
- <div class="container">
- <div class="row">
- <div class="span12"></div>
- </div>
- </div>
- </div>
- <section id="content" class="db-entry">
- <?php
- $post_type = 'anime';
- // $post_season = 'summer_2013';
- $post_genre = 'ALL';
- // $post_season = 'ALL';
- $post_types = 'ALL';
- $post_name = '';
- // if (isset($_GET['Season'])) {
- // $post_season = $_GET['Season'];
- // }
- if (isset($_GET['Genre'])) {
- $post_genre = $_GET['Genre'];
- }
- if (isset($_GET['Type'])) {
- $post_types = $_GET['Type'];
- }
- if (isset($_GET['n'])) {
- $post_name = $_GET['n'];
- }
- ?>
- <div class="container season-preview">
- <div class="row-fluid">
- <div class="span12">
- <h1>Search </h1>
- </div>
- </div>
- <div class="row-fluid">
- <form action="<?php get_site_url(); ?>" method="GET">
- <input type="text" name="n" />
- <div class="row-fluid">
- <div class="span12">
- <h3>Type </h3>
- </div>
- </div>
- <?php echo knoobie_build_search_checkbox('Type', 'a_types', 3); ?>
- <div class="row-fluid">
- <div class="span12">
- <h3>Genre </h3>
- </div>
- </div>
- <?php echo knoobie_build_search_checkbox('Genre', 'Genre', 8); ?>
- <input type="submit" value="Submit" />
- </form>
- </div>
- </div>
- <div class="container season-preview">
- <div class="row-fluid">
- <div class="span12">
- <h1>Serie </h1>
- </div>
- </div>
- <div class="row-fluid">
- <?php
- $args = kn_anime_query_args(10, 2, $paged);
- // if($post_season != 'ALL'){
- // $seasons = kn_anime_query_build_singletax('Season', $post_season);
- // }
- // if ($name != '') {
- // $args = kn_anime_query_name($args, $name);
- // }
- if ($post_types != 'ALL') {
- $types = kn_anime_query_build_singletax('a_types', $post_types);
- }
- if ($post_genre != 'ALL') {
- $genres = kn_anime_query_build_singletax('Genre', $post_genre);
- }
- $form_tax_fields = array(/* $seasons, */$types, $genres);
- $args = kn_anime_query_add_multitval($args, $form_tax_fields, 'tax_query', 'AND');
- if (!isEmpty($post_name)) {
- $jap = kn_anime_query_build_singlemeta('originalname', $post_name);
- $ger = kn_anime_query_build_singlemeta('germanname', $post_name, 'LIKE');
- $eng = kn_anime_query_build_singlemeta('englishname', $post_name, 'LIKE');
- $form_name_fields = array($jap, $ger, $eng);
- // $form_name_fields = array($ger);
- $args = kn_anime_query_add_multitval($args, $form_name_fields, 'meta_query', 'OR');
- }
- // $args = kn_anime_query_add_taxo($args, 'Season', $post_season);
- //// echo "<pre>";
- //// print_r($args);
- //// echo "</pre>";
- // $args = kn_anime_query_add_taxo($args, 'a_types', $post_types);
- //// echo "<pre>";
- //// print_r($args);
- //// echo "</pre>";
- // $args = kn_anime_query_add_taxo($args, 'Genre', $post_genre);
- // if(is_array($post_genre)){
- // $args = kn_anime_query_add_genre($args, false, $post_genre);
- // }else{
- // $args = kn_anime_query_add_genre($args, true, $post_genre);
- // }
- //// $args = kn_anime_query_add_genre($args, false, array('drama','advanture'));
- // $args = kn_anime_query_add_animetype($args, 'serie');
- echo "<pre>";
- print_r($args);
- echo "</pre>";
- // $myquery_series = new WP_Query($args);
- query_posts($args);
- if (function_exists('zn_pagination')) {
- zn_pagination();
- }
- echo '<table><thead><th>#</th><th>Name</th><th>Type</th></thead><tbody>';
- if (have_posts()) {
- while (have_posts()) : the_post();
- echo '<tr>';
- echo '<td>Nr.</td>';
- echo '<td>' . get_the_title() . '</td>';
- echo '<td>' . kn_anime_get_types() . '</td>';
- echo '</tr>';
- endwhile;
- } else {
- echo '<tr><td></td><td><p>Nothing found with</p><br>Season: ' . $post_season . '<br>Genre: ' . $post_genre . '</td><td></td></tr>';
- }
- echo '</tbody></table>';
- if (function_exists('zn_pagination')) {
- zn_pagination();
- }
- // wp_reset_postdata();
- ?>
- </div>
- </div>
- </section><!-- end #content -->
- <?php
- get_footer();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement