Wordpress pagination using wp_pagenavi

Asked

Viewed 45 times

0

I am making a pagination in wordpress using wp_paginavi. is working, he is creating the pagination, the problem is that the posts are not changing according to the pagination.

My loop:

<?php 

$the_query = new WP_Query(array(
    'post_type' => 'post',
    'category_name' => 'noticias'
    )); 
   while ( $the_query->have_posts() ) : 
   $the_query->the_post(); 
    $thumb = get_post_thumbnail_id();
        $img_url = wp_get_attachment_url( $thumb,'full' );
        $image2 = aq_resize($img_url, 150,150, $crop = true, $single = true, $upscale = true );
?>


  <div class="row index-blog">
    <div class="col-md-2"><img src="<?php echo $image2; ?>" class="img-responsive center-block" /></div>
    <div class="col-md-10">
        <h2><?php the_title(); ?></h2>
        <div><?php the_author_link(); ?> | <?php the_date('d-m-Y'); ?></div>
        <p><?php the_excerpt(10); ?></p>
        <div><a href="<?php the_permalink(); ?>"><img src="<?php bloginfo('template_url')?>/imagens/leia_mais.jpg" /></a></div>
    </div>
  </div>
  <?php 
   endwhile; 
   wp_reset_postdata();
  ?>
  <div class="pagin"><?php wp_pagenavi( array( 'post' => $the_query ) ); ?></div>

I think the problem is in my loop, someone could help?

  • 1

    Tried to pass that wp_reset_postdata for after the wp_pagenavi?

  • I won’t try! Thanks for the tip!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.