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
- Query Multiple Post Types and Paginate Newly Created List
- remove pagination from a single blog entry
- Function to limit number of custom post types on homepage – TwentyTen
- Get posts by category name
- How can I make custom static widgets/areas on my homepage?
- Displaying One Custom Post Type’s Content On Single Post of Another Custom Post Type
- Convert Custom Table Data Based Plugin To Be Searchable
- Why the_excerpt() function returns excerpt on the Home page and trimmed content in sidebar?
- Add Class according to the order of appearance
- next page with custom post
- Custom taxonomy query showing more than 4 posts
- Difference between page and paged
- Need to have an archive widget which organizes and displays a custom post type using a custom date field
- Taxonomy rewrite pagination 404
- Custom Content Type with No Page View
- Custom types, taxonomies and query optimization
- How to properly use Categories with Custom Post Types
- How to hide a custom field from admin?
- Get terms for a specfic post from multiple taxonomies in custom post type
- Custom post type tags not showing in search
- Problems making shortcode with custom post types and taxonomy
- custom comment fields on CPT
- Can’t pull posts of a Custom Post Type based on the custom taxonomy of the CPT
- CMB select with data from CPT
- All blog posts are not showing up
- Query Custom Post by taxonomy multiple categories
- 4 posts per page from single category
- Add Class After 4th Post
- $wpdb is queried but results don’t show
- Custom post pagination trouble
- cannot achieve this structure (custom posts VS categories VS ??)
- Post visibility option to theme front-end for author to select?
- How to list posts by term (custom taxonomy)
- Query custom posts from custom taxonomy
- Query Multiple Custom Post Types & Exclude a Taxonomy Term
- Custom Post type showing up in loop, regular posts are not showing up
- All in one calendar custom post type query doesnt work as expected
- Query custom posts of logged in user only
- How to keep a record of changes to a custom field?
- Function to add custom HTML into head in custom post-type list page
- Is it possible to have hierarchical taxonomy and hierarchical custom post types in one permalink?
- Pagination on a page
- Custom Post Type Pagination on Single.php?
- Custom taxonomy not saving correctly
- Display a random customposttype2 excerpt in single-custompostype1.php that shares same taxonomy
- What is the best way to manage small blocks of content on my home page?
- How to create Custom image post?
- Single parent post lists child posts with pagination
- Getting the list of the latests posts and custom type posts in the homepage
- One post auto attached to many another items
- How set template for “custom post type” individual post
- Changing WordPress sort order for returned child pages
- Using custom post type as front home page pagination not working
- Custom Post Type, Pagination and 404s?
- how to use custom post types collectively integrated with each other
- Use Gravity Forms and a Shopping Cart for output to Freshbooks for an Estimate [closed]
- Custom Post Type Implementation
- Custom post type pagination error
- Add custom post type to query
- Related “custom post type” using “custom taxonomy”
- Why doesnt my tag page populate with this custom post type?
- 2 custom post type paging in 1 custom taxonomy
- How to query custom post types with multiple keys?
- How do I “trash” a custom post type post while logged in as Admin
- Pagenavi Plugin and Custom Post Type – Multipage results
- Prioritising and Ordering Posts By Category Name Using A Custom Loop
- WP 3.1 custom post type permlinks
- Home page is getting current-menu-item even if it’s not home
- WordPress pagination with custom post type?
- Placing Admin Post Metaboxes in Tabs
- Can I get an auto-populated dropdown list of other custom posts in a custom post edit page?