how to add pagination to a popular post custom page?

Question

I want to add pagination to my custom page in a popular post, this is my coding.

   <div class="contentpost">
  <div id="rls" class="lr">
    <?php
    $popularpost = new WP_Query(array('post_type' => 'post', 'posts_per_page' => 10, 'meta_key' => 'post_views_count', 'orderby' => 'meta_value_num'));
    while ($popularpost->have_posts()) : $popularpost->the_post();
       ?>
     <div class="epshen">
        <div class="bx">
           <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
              <div class="thumb">
                 <div class="img">
                   <?php if (has_post_thumbnail()) {
                         the_post_thumbnail();
                      } ?>
                 </div>
                 <div class="hover"><span class="dashicons dashicons-controls-play"></span></div>
              </div>
              <div class="ix">
                 <div class="title"><?php the_title(); ?></div>
                 <span><?php echo getPostViews(get_the_ID()); ?> - <?php the_time('l, F jS, Y'); ?></span>
              </div>
           </a>
           <h2><?php the_title(); ?></h2>
        </div>
     </div>
   <?php endwhile; ?>
   <!-- End Popular Series -->
  </div>

0
, No Name 4 years 2019-11-03T17:59:33-05:00 0 Answers 61 views 0

Leave an answer

Browse
Browse