Support » Fixing WordPress » Pagination not working on custom category

  • Resolved macrocurio

    (@macrocurio)


    Hi,
    I have setup a custom category template for the category called 5test and I cannot get it to paginate within the category. I am using WP-PageNavi and when I go to the 5test category page it shows ‘Page 1 of 2’ and links to the next page – which results in a 404 error.
    I also currently have the Category pagination fix plugin installed which I used to fix a previous problem.

    here is my code:

    <div id="content">
    
    <h2 class="page-title"><?php _e('Category:', 'sandbox') ?> <span><?php echo single_cat_title(); ?></span></h2>
    
    <div id="post">
    
    <?php
    query_posts( array( 'cat' => 4, 'showposts' => 1,'paged' => get_query_var('page') ) );
    ?>
    
    <?php while (have_posts()) : the_post(); ?>
    
    <?php the_content() ?>
    
    <?php endwhile ?>
    
    <?php
    wp_pagenavi();
    ?>
    
    </div>
    
    </div>
    </div>
    
    <?php get_footer() ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @macrocurio,

    seems your query post to be changed.

    <?php
    query_posts( array( 'cat' => 4, 'showposts' => 2,'paged' => get_query_var('page') ) );
    ?>

    I think You must get at least 2 post to work page navi . try this

    Hey saransays2u,

    Thanks for your help – your suggestion works great, but I need to show 1 post per page… would it be better to try another plugin for this?

    Hey I’ve had a fiddle and I’ve fixed the problem myself. I ended up using the Custom Post limits plugin with page navi and now I’m getting one post per page, and it’s paginating.

    Thanks for your help saransays2u 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pagination not working on custom category’ is closed to new replies.