• Resolved aliwkbg

    (@aliwkbg)


    Ok, after searching hours of hours to find a solution.
    I present you my solution with custom query and category with wordpress 3.5

    // if paged doesn´t work - try >> $current_page = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $current_page = (get_query_var('paged')) ? get_query_var('paged') : 1;
    // get category name
    $cat_name = get_category(get_query_var('cat'))->name;
    
    		$args = array(
    		   'category_name' => $cat_name,
    		   'posts_per_page' => '4',
    		   'paged' => $current_page,
    		 );
    	}
    $my_query = new WP_Query($args);
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID;
    ?>
    
    <!-- your loop here -->
    <?php the_title(); ?>
    <!-- loop end -->
    
    <?php endwhile; ?>
    <?php if (function_exists('wp_pagenavi')):
     wp_pagenavi( array( 'query' => $my_query ) );
    endif; ?>
    <?php get_footer(); ?>

    If the pagination generates error pages again, try this method together with our custom query above:

    1. Login to your wp-admin
    2. Click on “Settings”
    3. Click on submenu “Reading”
    4. Change “Blog pages show at most xx Posts” to 1

    After changing this value – Your custom query pagination should be fine!!! 🙂

  • The topic ‘[Tutorial] WordPress Custom Query Pagination for Category / wp_pagenavi Plugin’ is closed to new replies.