I’m trying to make page navigation for my project. I installed a plugin wp_pagenavi. It appears but when i click on 2 page, url changes number(page/2) but posts stay the same. Here is my code:

<?php if ( have_posts() ) : query_posts( array( 'cat' => 20','status'=>'publish'  ));
while (have_posts()) : the_post(); ?>
              <div class="media post">
             <div class="media-img"><?php the_post_thumbnail(array(360,230)); ?>
                  <div class="post-data with-img">
                    <p class="day"><?php the_time('j') ?></p>
                    <p><?php the_time('m') ?>.<?php the_time('Y') ?></p>
                  </div>
                </div>
                <div class="media-body">
                  <h4 class="heading"><?php the_title(); ?></h4>
                  <p><?php the_content(); ?></p>
                </div>
                <a href="<?php the_permalink() ?>" class="button main">Learn more</a>
                  <hr>
              </div>
              <? endwhile; ?>
              <?php wp_pagenavi(); ?>
              <? endif; wp_reset_query();?>

Read more here: Page Navi doesn’t work properly


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: