If this is the main loop you use to display posts on your page, you should not execute a new loop but modify the existing loop that WordPress will execute anyway. This way you can be sure that all extra query parameters will be taken into account.
Here we want to display posts of type game
and limit the number of posts on the page. You can do this with the following code:
add_action( 'pre_get_posts', 'wpse5477_pre_get_posts' );
function wpse5477_pre_get_posts( &$wp_query )
{
if ( $wp_query->is_category() ) {
$wp_query->set( 'post_type', 'game' );
$wp_query->set( 'posts_per_page', 2 );
}
}
Related Posts:
- Display “Post 2 of 4” on single post page?
- How i can add ‘N’ page of ‘N’ pages under posts loop?
- Page vs Custom Post Types Differences/Issues
- How to display data with pagaination on backend?
- Pagination not working with custom loop
- Hook for post and page load
- WP_Query Pagination on single-custom.php
- Integrating a custom post type into a page hierarchy
- Have different number of posts on first page
- Custom Post Type Slug / Page Slug Conflict – Prevent use of reserved slug on page save?
- Searching multiple custom post types and pages
- Custom pagination for custom post types (by names)
- Custom post type pagination 404 fix?
- next_post_link() not working for single custom post type post
- wp_pagenavi() with custom wp_query()?
- Pagination with custom post type not working
- Return current page type
- Custom post type archive 404’s with paginate_links
- How do I Paginate Search Results for Custom Post Types?
- Custom Post Type as Page parent
- Pagination throws 404 error on custom taxonomy archive pages
- Changing the URL Structure of a Paginated Custom Post
- Custom Post Type Pagination Not Working On Archive Page
- Custom Post Type Archive Page: Set Posts Per Page, Paginate
- How to add a post from a custom post type as the static page?
- Get page by template?
- Page as child in custom post type slug?
- Number of pages – multiple (custom) post types
- WordPress search: pretty URLs (permalinks), custom post types and pagination
- Pre get posts for single post
- Multiple Paginations on one Page
- Archive page…limiting posts per page
- Is it proper to create a page just to generate a listing page (eg. for a custom post type)
- Pagination not working with custom category template
- TV Show database – Best way for structuring it?
- Is there a way to make a custom Page type?
- Shortcode Displaying Custom Post Types
- Custom permalink with pagination
- Related posts by author pagination not working on the production site
- Menu position (admin menu) of pages
- Secondary loop pagination on custom post type single post gets redirected to first page
- How to Add Pages Under Custom Post Type URL Structure?
- Custom Post Type pagination – normal solutions aren’t helping
- Custom Post Type Archives by Date (stored as meta value) WP3.1
- Pagination Doesn’t Work
- Numeric pagination custom post type
- Custom Posts on Different Pages
- Custom Post Type Rewrite Rule for Author & Paging?
- Pagination go to first page if i’m on last post
- Posts in Multiple Columns and Rows with one single loop
- Pagination throws 404
- Pretty paged permalinks in custom post type loop
- Newer/Older posts links display same posts on every page
- Custom wp_query pagination – next_posts_link() or wp_pagenavi() always empty
- Group list of posts by taxonomy and allow for pagination
- Custom post type archive with pagination?
- Include images from pages in wp search.php results in default wp search
- Priority for Categories, Tags, Taxonomies, Posts, Pages and Custom Posts with same url
- How to create user personal pages with information from their meta profile fields?
- Pagination on a custom page template
- Custom Post Type pagination when CPT ‘rewrite’ rule and a page have the same slug
- Exclude Custom Post Type & Pages From Auto-Tag Function
- paginate function in archive for custom-post-type
- Pagination problems with multiple custom post type archive pages
- Pagination in plugin with custom post type
- Fix custom query pagination without changing site-wide posts-per-page settings
- custom post type paging not working past page 3
- Custom Post Type, Two categories, Two columns with Pagination
- posts_nav_link on single post template
- Pagination problem in custom post type used as front page
- Custom Taxonomy archive returns 404
- Pagination gives 404 error
- Paginate Custom Post Type Page
- Creating a simple pagination for custom post type templates
- WP_Query pagination using only numbers instead of /page/1 on URL
- Custom Post Types, Page Templates and Pagination. Why do I get a 404 Error?
- Custom Post Type Name Causing Problem
- Pagination with custom post types results in 404 issues
- Make custom post type display as a page
- wp_list_pages doesn’t work in hierarchical custom post type
- Pagination not working
- Pagination Custom post type
- Pagination Issue: Custom Post Type In Index
- Custom query form submission pagination
- Paginated Taxonomy Term Archive including one post per term
- WordPress rewrite my URL when i use pagination
- Pagination links not showing on custom post type admin list
- Pagination on Custom Post Type: 404 Error
- Custom Post Type Pagination & duplicate posts
- Pagination in a Shortcode. Get_next_posts_link not working but get_previous_posts_link works fine right next to it
- Multiple portfolios with one custom post type?
- Is it possible to use pages to apply static content to each taxonomy level?
- Making pages also serve as taxonomies? Or give full pages to taxonomies?
- Share parent path between Custom Post Types and Pages?
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- ‘Pages’ widget alternative for custom post types?
- Custom post type archive page pagination
- Pagination problem
- Custom Blog Post Listing in Genesis Sample Child Theme
- How to load custom post archives sub-pages with ajax?