I’m trying to set up a custom paginated (!important) page that will show 9 posts on page 1, and 18 posts on each subsequent paginated page.
Here’s an example of the query I’m using:
// pagination for custom page(s) $paged = (get_query_var('page')) ? get_query_var('page') : 1; //get posts_per_page count if ( $paged < 2 ) : $postcount = 9; else: $postcount = 18; endif; //query args $idObj1 = get_category_by_slug('updates'); $catid1 = $idObj1->term_id; $args1 = array( 'posts_per_page' => $postcount, 'order' => 'DESC', 'post_status' => 'publish', 'cat' => $catid1, 'paged' => $paged ); //$updates = get_posts($args1); query_posts($args1);
The problem that I am running in to is that no posts are showing up on the paginated pages. 1 thing to note: Pagination works perfectly fine if I remove if statement.
I’m assuming it’s due to my changing the value of posts_per_page while processing the same loop, but I’m not sure about how to go about doing what I need.
- The topic ‘Change posts_per_page count on paginated pages’ is closed to new replies.