• Hi!

    I’ve been looking around for a solution to displaying a separate amount of posts specifically for the archive pages, and thought I had came up with some working code, however I see it messes up pagination. Basically page 2 of the archive displays the same posts as the archive front page. Link: https://hvamgolfklubb.no/category/ukategorisert/

    Code:

    <?php 
    
    				/* Sets the amount of posts to display for $querycat */
    				$querycat = new WP_Query( 'posts_per_page=4' ); ?>
    
    			<?php
    			/* Start the Loop */
    			while ( $querycat->have_posts() ) : $querycat->the_post(); /* Display $querycat amount of posts */
    
    				/* Include the post format-specific template for the content. If you want to
    				 * this in a child theme then include a file called called content-___.php
    				 * (where ___ is the post format) and that will be used instead.
    				 */
    				get_template_part( 'content', get_post_format() );
    
    			endwhile;
    
    			wpbeginner_numeric_posts_nav();
    			?>

    Any help is appreciated. It’s not the numeric pagination that creates the error.

  • The topic ‘new WP_Query messes up pagination’ is closed to new replies.