WordPress.org

Ready to get started?Download WordPress

Forums

Problem: different number of posts per page VS. loop and Infinite Scroll (1 post)

  1. cehh
    Member
    Posted 2 years ago #

    Hey,

    I have some problems with the number of posts per page, the loop, and the plugin "Infinite Scroll".
    Infinite Scroll is loading one page after another on one singel page - without reload - just jQuery.
    My problem is, that i simply want on the first page less posts (13) than on the following pages (18 - global standard is also 18). What i get with the following code is the correct number of posts per page, but also 5 missing posts on page 1 (the last 5 posts >> 13 + 5 = 18).

    if(!$wp_query) global $wp_query;
    if (is_category(4)){
    	if ($current_page == 1){
    		$posts = 13;
    	} else {
    		$posts = 18;
    	}
    }
    query_posts( array_merge( array( 'posts_per_page' => $posts ) , $wp_query->query ) );

    What can i do to get the correct number AND the correct position of the pagebreak? Maybe there is a way to define the number of posts per page for each page before loading?

    I hope you can help (and sorry for my bad english)

    Cheers

Topic Closed

This topic has been closed to new replies.

About this Topic