Pagination not working with pagenavi
I am using PageNavi and have been searching around trying to figure out why I can't get pagination to work. Currently, the page numbers show but when you click on the page numbers, it goes to a page not found page.
Here are some links I've reviewed:
https://toolset.com/forums/topic/help-to-get-wp-pagenavi-working-for-page-2-onwards/
pagenavigation not showing the next page just linking back to the main page
Here is my code:
?php
/*Query DW Hammer Articles*/
$counter = 1; //counter tracks the number of the post we're on
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$args = array(
'posts_per_page' = 2,
'post_type' = 'news_article',
'orderby'= 'date',
'order' = 'DESC',
'paged' = $paged
);
$newsQuery = new WP_Query( $args);
if ( $newsQuery-have_posts()) : while ( $newsQuery-have_posts()) : $newsQuery-the_post();
?
?php get_template_part('templates/content', get_post_type() != 'post' ? get_post_type() : get_post_format()); ?
?php $counter++; endwhile; ?
?php wp_reset_query(); endif;?
div class="wp-pagenavi-container"
?php wp_pagenavi( array( 'query' = $newsQuery ) ); wp_reset_query();?
/div
Topic plugin-wp-pagenavi pagination plugins Wordpress
Category Web