WP_Query docs gives a warning about the offset parameter: Setting the offset parameter overrides/ignores the paged parameter and breaks pagination.
Try something like this:
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$newsArticles = new WP_Query(array(
'posts_per_page' => 16,
'post_type'=> 'news',
'paged' => $paged,
));
while( $newsArticles->have_posts()){
$newsArticles->the_post(); ?>
// HTML
<?php } ?>
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $newsArticles->max_num_pages
) );
See more examples of paginate_links here:
Related Posts:
- pagination not working for category.php (custom post types in categories)
- Custom post type pagination error
- Fourth page of custom post type archive page does not exist
- Query Multiple Post Types and Paginate Newly Created List
- Pagination not working with custom loop
- Display all posts in a custom post type, grouped by a custom taxonomy
- Have different number of posts on first page
- How do you get the count of posts in an archive page?
- wp_pagenavi() with custom wp_query()?
- How to use a custom post type as front page?
- Custom post type archive 404’s with paginate_links
- Custom Post Type Pagination Not Working On Archive Page
- Custom Post Type Archive Page: Set Posts Per Page, Paginate
- Display several random posts, but make sure a condition is met
- Number of pages – multiple (custom) post types
- WP_Query orderby modified to include custom meta changes
- How to make sure content doesn’t display if selection is empty
- Show one item per category of a custom post type
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- How to display all posts from standard posts to custom post types in a loop with pagination?
- Previous/Next Link by Meta Value in CPT
- Pagination for Custom Taxonomy Page [duplicate]
- Pagination on with query_posts in custom post type template
- Custom loop with multiple taxonomy queries
- Paging doesn’t work?
- Custom taxonomy rewrite give pagination 404
- Woocommerce search pagination not working
- What’s the WP way to load remaining custom posts?
- How do you paginate a query grouped by month?
- WP Query with categories only shows one post and ignores the category
- Pagination issue on category.php using custom post type query
- Problem: wp_query outputs all images on site
- Custom Theme With Custom Loops
- Custom Post Types strange pagination problem
- Pagination with custom query, custom search form, single and pages, ajax and no plugins
- can these 3 queries be re-written as 1 query?
- Wrapping x posts in html without leaving empty html
- WP Query post__in not returning correct results
- Sort posts in loop by the WooCommerce Membership of the author
- How can I group posts by months and years?
- Pagination Error : Duplicate argument being outputted
- Multiple Custom Post Type queries, how to DRY it up
- Custon Content within WordPress Loop
- Loop increase number
- Custom WP_Query always respond with 200 status even when no entry
- Using wp_query to modify the loop in index.php for a CPT
- Custom WP_Query doesn’t display all posts
- Query & the_content() is showing in the header
- Pagination doesn’t function properly for archive of a custom post type set as the front page
- Creating two loops based on different logic
- Trouble with pagination
- Pagination 404 on Index with custom query
- get_pagination not working on a custom post type query (using WP_Query)
- WP_Query with custom post type ID
- Stomping WP_Query in author archive to facilitate pagination with custom queries
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- Pagination not working on custom query on a page
- display posts of custom post type with custom taxonomy
- Custom post type and custom taxonomy 404 on page 2
- Trying to add a class to post links
- postsperpage value not being applied
- Pagination for search results of custom post type [duplicate]
- Display the current post in browser as the first post in a loop (for a slideshow)
- Custom Post Type Archive Pagination
- Display post from custom post type
- List all Custom Post Type posts excluding certain Taxnomy term
- foreach loop inside the loop creating duplicates in output
- How can I pull information from my loop and divide them seperately?
- Custom post type blog pagination conflict
- Custom post type pagination, single page issue
- Pagination always adding “Next” link when results come from Custom Post Type WP_query
- Pagination not working with custom loop
- Fallback if statement based on the number filtered from it
- Paged within a custom content type template [duplicate]
- Pagination not working with custom loop
- Pagination not working with custom loop
- Pagination not working with custom loop
- next_posts_link returns same content of 1st page
- Pagination not working with custom loop
- Custom loop won’t work, can’t find problem
- Custom post-type’s pagination not working in category.php
- Pagination not working on homepage
- send user to first page of results when reposting to page?
- Query Custom Post Type by Tag
- Pagination broke after updateto WordPress 3.4 [duplicate]
- Catergory args causing loop not to show
- Archive page – problem with pagination
- How do I correctly query posts from a post ID?
- display custom post type from register taxonomy
- How to exclude certain portfolios from a loop
- Custom post type and have_posts() return empty result
- Unable to display paging navigation with a custom post type loop
- WPNavi pagination links not working on custom pages
- How can I show posts with the same tag?
- How to insert a post from a different post type after every nth post
- Complex Custom Loop with Includes
- SOLVED: Shortcode to display Divi project filtered by tag in WP Query loop
- “Page not found” while on page 2 from pagination menu
- Create an archive page by combining two post type
- author archives, showing all custom post types, problem on pagination