If you are trying to add pagination on for your custom post type using "WP-PageNavi" plugin in your site then you have need to add custom post type query in wp_pagenavi() function after end of while loop
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$loop = new WP_Query( array( 'post_type' => 'portfolio-type', 'post_status' => 'publish', 'posts_per_page' =>'5','paged'=>$paged ) );
while ( $loop->have_posts() ) : $loop->the_post();
<article id="post-<?php echo $postIDD; ?>" <?php post_class(); ?>>
$post_7 = get_post($postIDD);
$cont = $post_7->post_content;
echo strip_tags($cont); ?>
<br><a target="_blank" href="<?php echo get_post_meta($postIDD,'wpcf-url',true); ?>"> </a>
endwhile; // end of the loop.
wp_pagenavi( array( 'query' => $loop ) ); //pagination
4 Replies to “How to add pagination for custom post type?”
I’m amazed, I must say. Rarely do I come across a blog that’s both educative and interesting, and without a doubt, you’ve hit the nail on the head. The issue is something which too few men and women are speaking intelligently about. I am very happy that I found this in my search for something relating to this.
Your Most Welocme Amazed!
Believe in Better
What’s up it’s me, I am also visiting this web page daily,
this website is actually fastidious and
the users are really sharing nice thoughts.
WOW just what I was looking for. Came here by searching for sfds