0

i'm query multiple taxonomies and have no problem with it but pagination is not working how to solve it, i try alot of suggestion but no success here is my code

        if ( get_query_var('paged') ) {
            $paged = get_query_var('paged');
        } elseif ( get_query_var('page') ) {
            $paged = get_query_var('page');
        } else {
            $paged = 1;
        }
        if(isset($_POST['genre'])) {
            $myquery['tax_query'] = array(
            'showposts' => 20 ,
            'orderby' => 'title',
            'order' => 'ASC',
            'paged' => $paged,
            'relation' => 'AND',
            array(
                'taxonomy' => 'anime_genre',
                'terms' => $_POST['genre'],
                'field' => 'slug',
                'operator' =>'AND'
                )
            );
        }
        query_posts($myquery);
            if (have_posts()):
                while (have_posts()):
                    the_post();
                    mystique_post();
                endwhile;
            wp_pagenavi();
            else: ?>
                <h1 class="title error"><?php _e("No posts found","mystique"); ?></h1>
                <p><?php _e("Sorry, but you are looking for something that isn't here.","mystique"); ?></p>
            <?php 
            endif; 

i have no problem with query taxonomies but only pagination is not working

0

May be this will help:

    ........
    ........
    if(isset($_POST['genre'])) {
        $myquery = array(
            'showposts' => 20 ,
            'orderby' => 'title',
            'order' => 'ASC',
            'paged' => $paged,
            'tax_query' => array(
                'relation' => 'AND',
                array(
                    'taxonomy' => 'anime_genre',
                    'terms' => $_POST['genre'],
                    'field' => 'slug',
                    'operator' =>'AND'
                )
            )
        );
    }
    query_posts($myquery);
    ......
0

some how i managed to resolve my problem but another problem poped up,

    $paged = 1;
    if ( get_query_var('paged') ) $paged = get_query_var('paged');
    if ( get_query_var('page') ) $paged = get_query_var('page');
  $args=array(
'paged' => $paged,
'post_type'=>'animes',
'post_status'=>'publish',
'order'=>'ASC',
'posts_per_page'=>'15',
'orderby'=>'title',
'tax_query'=>array(
    array(
        'taxonomy' => 'anime_genre',
        'terms' => array('drama','romance'),
        'field' => 'slug',
        'operator' =>'AND',
    ),

)
);

    print_r($args);
    $loop = new WP_Query($args);
    //wp_reset_postdata();
    //query_posts($myquery);
    if ($loop->have_posts()){
    //while ( have_posts() ) : the_post();
    while ( $loop->have_posts() ) : $loop->the_post();
    // output
  //        the_post();
    $loop->the_post();
    mystique_post();
    endwhile;
    //mystique_pagenavi();
    if ( function_exists( 'wp_pagenavi' ) ) {
        wp_pagenavi( array( 'query' => $loop ) );
        wp_reset_postdata();
    }

    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.