The pagination works only, if the paged
attribute in the the global $wp_query
variable is set. You could store your query manually in this global or just use query_posts()
instead of new WP_Query()
.
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$the_query = query_posts(
array(
'post_type'=>'article',
'posts_per_page'=>2,
'orderby'=>'date',
'paged'=>$paged
)
);
// ...
?>
The function query_posts()
will unset an existing $wp_query
global, runs a new WP_Query()
and stores the result again in the global $wp_query
variable.
Related Posts:
- How do I Paginate Search Results for Custom Post Types?
- Pagination throws 404 error on custom taxonomy archive pages
- Custom Post Type Pagination Not Working On Archive Page
- Custom Post Type Archive Page: Set Posts Per Page, Paginate
- Archive page…limiting posts per page
- Shortcode Displaying Custom Post Types
- Related posts by author pagination not working on the production site
- Pagination go to first page if i’m on last post
- Pagination throws 404
- Pretty paged permalinks in custom post type loop
- Custom Post Type pagination when CPT ‘rewrite’ rule and a page have the same slug
- custom post type paging not working past page 3
- Custom Post Type, Two categories, Two columns with Pagination
- Pagination gives 404 error
- Creating a simple pagination for custom post type templates
- Pagination not working
- Pagination Custom post type
- WordPress rewrite my URL when i use pagination
- Custom Post Type Pagination & duplicate posts
- Unable to get paginate_links working with a custom query [duplicate]
- Custom post type, permalinks & pagination, going wrong
- Repeating posts when paginating random posts
- How to add pagination to wp_query [duplicate]
- Hard code the nextpage tag into my theme?
- Pagination for custom php code
- Pagination for Custom Taxonomy Page [duplicate]
- Pagination on with query_posts in custom post type template
- Pagination of Custom Post Types not Changing Posts
- Paging doesn’t work?
- Help with Elementor Pagination CPT archive 404 problem
- Custom taxonomy rewrite give pagination 404
- Next and Previous Posts of Same Parent
- How to handle paged param in post and custom-post-type?
- List all posts in a custom post type with pagination (the correct way)
- Category with post type pagination returns 404
- Pagination issue on category.php using custom post type query
- Next Post links not working in custom post type shortcode
- Custom Theme With Custom Loops
- Custom Post Types strange pagination problem
- Custom post type pagination – always return first page
- Number of posts in the archive
- Pagination custom post type not working with rewrite slug
- Pagination Not Working for Custom Taxonomy with Custom Query – 404 Error
- Custom WP_Query always respond with 200 status even when no entry
- Pagination 404 on Index with custom query
- Pagination doesnt work in custom post type
- Break up posts per page in two sections
- Pagination on search results page
- 404 Page Not Found on /Page/2/ on Tag Page
- Pagination for custom post types – url rewriting
- Custom Post Type Archive Pagination
- next page with custom post
- Taxonomy rewrite pagination 404
- Custom Post Type Pagination on Single.php?
- Custom post type pagination error
- Pagenavi Plugin and Custom Post Type – Multipage results
- Add pagination to custom single post template
- get_query_var(‘paged’) return 0 in custom category page
- Custom post type paging return home page
- Pagination on custom post type without plugin
- Remove custom taxonamy slug with pagination
- Add Pagination in custom Blog page template
- Why is my loop not populating the page with my custom taxonomy terms from my custom post type?
- Pagination for custom query returns 404
- Custom post type pagination problem – page 1 and 2 show same content
- Custom Post Type Pagination – not displaying posts
- How to add pagination to a post loop in a custom BuddyPress tab
- next_posts_link() always generates second page link on custom post type
- Post navigation doesn’t show (in custom template, custom post type, custom query)
- 2 custom posts types, in their own columns, one pagination for both
- Pagination functions won’t work
- pagination for a custom query
- Custom Pagination based on Custom Post Type
- Paging not working for hierarchical custom post type
- Custom taxonomy in custom post type archive with pagination
- How to Fix Custom WordPress Loop with Pagination on Single Post View?
- why custom post archive gives always no more than 10 posts despite of paging settings?
- Pagination on custom post types
- How to display data with pagaination on backend?
- Custom Post Type Pagination Not Working or Single Posts Displaying?
- 404 error Custom search results page for custom post types with friendly URL
- Pagination in custom loop for custom post type throwing 404 error
- Pagination for a Custom Taxonomy
- Pagination with Custom Post Type
- paging is not working properly on news archives page [duplicate]
- Pagination URL order
- WordPress Load more posts by ajax not working
- Paged within a custom content type template [duplicate]
- Pagination for event query
- Problems with pagination for a custom post type
- WordPress custom post type post and category links 404
- Pagination not working for archive
- Archive page – problem with pagination
- See the process of creating a taxonomy and tell me where I made a mistake
- Pagination not working in custom post type
- Pagination not working
- Pagination on category pages using wp_pagenavi causes 404 errors
- CPT Archive Pagination – Page not found
- WPNavi pagination links not working on custom pages
- Custom post type pagination conflict result in 404