Pagination Not Working When Used With WP_Query() `offset` Property
I have an archive page that pulls in posts using WP_Query()
. On the homepage of the site it shows 16 of the custom post type posts, so on the archive I offset the archive page by 16 posts.
The code for this is:
$newsArticles = new WP_Query(array(
'posts_per_page' = 16,
'offset' = 16,
'post_type'= 'news'
));
while( $newsArticles-have_posts()){
$newsArticles-the_post(); ?
// HTML
?php } ?
However on this archive page the ?php echo paginate_links();?
function to show the pagination pages doesn't work. When I click on the page numbers or use the next and previous arrows, but it just shows the same posts on each page.
The pagination code I'm using is:
p
?php echo paginate_links(array(
'prev_text' = 'NEWER',
'next_text' = 'OLDER',
));?
/p
Does anybody know how I get the pagination to work with the WP_Query()
property offset
so the archive pagination behaves like a normal archive page (with pagination) ?
Topic offsets loop wp-query pagination custom-post-types Wordpress
Category Web