Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

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();
    }

    }
share|improve this answer
add comment

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);
    ......
share|improve this answer
    
thanks mamun reza –  user1489083 Aug 1 '12 at 18:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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