I have made my own costum post type in wordpress. I have already use WordPress's post type on my website. So i actually have two post type who running the loop on my website. But now i have kinda trouble with the pagination. It won't paginate from my own post type. Its like my post type and pagination wont work together. Because the pagination display that there are 2 pages, but when i click on page 2 it only display the same posts as on page 1.
<?php
$holdene = get_field('kampreferaterne');
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$the_query = query_posts(array(
'post_type'=>'kampreferater',
'paged'=>$paged
));
$kampf_args = array(
'post_type' => 'kampreferater',
'tax_query' => array( array(
'taxonomy' => 'hold_kategori',
'terms' => $holdene
))
);
$kampf = new WP_Query($kampf_args);
?>
<?php if ( $kampf->have_posts() ) : while ( $kampf->have_posts() ) : $kampf->the_post(); ?>
some content..
<?php wp_reset_postdata(); ?>
<?php endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
<nav class="pagination">
<?php wp_pagenavi(); ?>
</nav>