You can change the posts_per_page
variable depending on the page you are on, so make it 10 on the first page and 20 on the other pages. However, you will have to modify the offset
query variable too, otherwise you will skip posts 11-20 on the second page, because this page thinks they are already displayed on the first page.
add_action( 'pre_get_posts', 'wpse15087_pre_get_posts' );
function wpse15087_pre_get_posts( &$wp_query )
{
if ( $wp_query->is_post_type_archive( 'apartments' ) ) {
if ( ! $wp_query->is_paged() ) {
$wp_query->set( 'posts_per_page', 10 );
} else {
$wp_query->set( 'posts_per_page', 20 );
$wp_query->set( 'offset', ( ( $wp_query->get( 'paged' ) - 2 ) * 20 ) + 10 );
}
}
}
Related Posts:
- How do I move/order posts with a tag to the end?
- Pagination not working with custom loop
- Get the ID of the latest post
- Custom Post Types, Page Templates and Pagination. Why do I get a 404 Error?
- Show Two custom Post type and their posts on category page
- Setting posts per page in query_posts
- CPT: if more than X images are in post, use pagination
- How inefficient is it to use a Custom Post for 4-5 sentences & pull all to 1 page?
- Meta query for custom post type ignored in main query
- How to handle paged param in post and custom-post-type?
- Custom query for custom post_type
- Displaying multiple post types on home page
- Conflict between wp_list_pages and get_posts – list pages not displaying
- Break up posts per page in two sections
- Pagination on search results page
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- pagination for a custom query
- Custom Pagination based on Custom Post Type
- Help ordering custom query by Title, Ascending
- How do I get a nested query to only display content that the main query outputed
- Pagination in custom loop for custom post type throwing 404 error
- Pagination not working with custom loop
- how to limit query_post to first page?
- Pagination not working with custom loop
- Pagination not working with custom loop
- Pagination not working with custom loop
- Pagination not working with custom loop
- custom post-type query just returns two posts
- How can I show a field ID in Elementor with Request Parameter
- wp_pagenavi() with custom wp_query()?
- Getting the Intersection of Two Custom Taxonomy Terms for a Custom Post Type?
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- Redirect after deleting post and keep track of pagination
- Querying Posts by Taxonomy From Alternate Network Site
- remove_action conditionally for Custom Post Type
- WP_Query pagination using only numbers instead of /page/1 on URL
- How do I add a custom button to my “edit” list? ( edit.php?post_type= ) beside “Add New”
- How to get Custom Post ID by adding filter to child theme’s function
- Remove All, Published and Trashed Post Views in Custom Post Type
- pagination redirecting from page number url before page requested
- WordPress if in term*
- Custom post type redirected to homepage – how to debug
- Making certain categories of CPT not publicly queryable
- Conditional Query of Custom Post Type and custom taxonomy
- Query Multiple Custom Posts by Custom Fields
- Specific query for custom post type
- Structure of data : CPT + terms
- Default text in a specific post type, but not visible?
- Display post content with respect to its title?
- How to remove post listing page for a custom post type
- How to include term custom meta into the custom taxonomy term permalink structure
- Is it possible to to use custom post type types on a page with the same slug somehow?
- WordPress custom post query with pagination
- Prioritize posts in query by meta keys?
- WP_Query orderby and tax_query
- Different Ways to Query Custom Post Types?
- How to display custom field value on page?
- Pagination doesn’t function properly for archive of a custom post type set as the front page
- Make (custom) post type accessible only by custom query
- Using Pagination for Custom Post Type and keeps returning 404
- Pagination for search results of custom post type [duplicate]
- meta query not retrieving posts
- CMB select with data from CPT
- All blog posts are not showing up
- Multiple categories assigned to a single product breaking the breadcrumb
- How to divide Subcategories into pages of parent category wordpress
- Adding a location field to buddypress activity
- get_posts() returns empty on custom post type /wp-admin/edit.php
- WP Query: If field X is empty, show posts based on field Y
- How can I assign multiple parents to CPT?
- Custom post type order by post_title
- Getting 404 on child page with pre_get_posts() on custom posts
- Custom post pagination not working
- Limit posts per page depending on the size of a div?
- CPT/Taxonomy/Postname permalink structure makes pagination break
- Delete Post by User
- save_post affect creation and deletion
- Pagination in wp-admin for CPT
- Set a static page as a user profile page?
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- Add pagination to custom page
- How to display all custom fields associated with a post type – IN THE ADMIN AREA?
- How to keep a CPT stick to specific position?
- Custom Post Type shows pagination (w/404) or posts_per_page query, but not both
- WP_Query for CPT with filter by another WP_Query
- Is it possible to add query parameters on the archive page?
- Custom post type archive pagination with HTML5Blank theme?
- Paginate custom taxonomy category with wp_custom_pagination
- Custom pagination [duplicate]
- Query Only Show Text on Posts With Certain Taxonomy Tag
- Query Posts From Multiple Post Types
- Problems with a custom meta_box
- Show custom posts with a specific “custom TAXONOMY slug” on startpage
- How to make a template for a specific post of a custom post type?
- Bulk update custom post types
- show custom post’s post in two different divs [duplicate]
- ACF select box css color change
- Creating post custom field text area
- Create a hierarchical list of posts that’s grouped and nested by category
- Two pagination in one page without AJAX