• I have the following, at the top of a custom category page in my theme (i.e. category-slug.php) before the ‘get_header();’ call:

    <?php
    
    global $wp_query;
    
    query_posts(
    	array_merge(
    		$wp_query->query,
    		array(
    			'posts_posts' => '1'
    			)
    	)
    );
    
    ?>

    When I’m viewing the page ‘https://site/category/slug&#8217; it only shows 1 page.

    But for some reason, when it goes onto page 2 ‘https://site/category/slug/page/2&#8217; the query contains ‘posts_per_page’ set to ’10’ (10 being my default) and therefore misses the rest of my posts, as it has offset at 10. ??

    Why on earth would it do this, I have no sticky posts, just 4 posts in that category. Any help would be greatly appreciated as this is really annoying me.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Not quite sure what you are trying to achieve. I do not believe that ‘posts_posts’ is a valid query_posts argument.

    If you only want one post per page, change that to ‘posts_per_page’ => 1.

    Thread Starter tawilson

    (@tawilson)

    Grr. I meant post_per_page, and that’s what my code currently says, and it still exhibits the behaviour mentioned above.

    My bad!

    I have seen several reports of pagination problems when trying to override the Admin->Settings posts per page.

    One report said that changing the query from ‘cat’ => 22 to ‘category__in’ => array(22) solved the problem. You might try adding that to your merged args.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘posts_per_page, bizarre behaviour?’ is closed to new replies.