WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Pagination not working on custom category (4 posts)

  1. macrocurio
    Member
    Posted 1 year ago #

    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() ?>
  2. saransays2u
    Member
    Posted 1 year ago #

    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

  3. macrocurio
    Member
    Posted 1 year ago #

    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?

  4. macrocurio
    Member
    Posted 1 year ago #

    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 :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.