Custom Post Pagination not working

Custom post query

  1. post type download
  2. post content style content-item.php
  3. post pagination function st_posts_pagination
 <?php
 global $wp_query;
 query_posts( array('post_type' => array( 'download' ), 'paged'=>$paged )
 );?>

 <?php if(have_posts()) : while (have_posts() ) : the_post(); ?>
 <?php get_template_part('content', 'item'); ?>
 <?php endwhile; ?>
 <?php ?>
 <div class="col-md-12">
 <div class="page-link text-center">
 <?php st_posts_pagination(); ?>
 </div>
 </div>

 <?php endif; ?>

pagination function code

&nbsp;if (!function_exists('<span style="color: #00ccff;" data-mce-style="color: #00ccff;">st_posts_pagination</span>')) {
 function <span style="color: #00ccff;" data-mce-style="color: #00ccff;">st_posts_pagination</span>()
 {
 global $wp_query;
 if ($wp_query->max_num_pages > 1) {
 $big = 999999999; // need an unlikely integer
 $items = paginate_links(array(
 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
 'format' => '?paged=%#%',
 'prev_next' => TRUE,
 'current' => max(1, get_query_var('paged')),
 'total' => $wp_query->max_num_pages,
 'type' => 'array',
 'prev_text' => __('<i class="fa fa-angle-double-left"></i>', 'rubel_miah'),
 'next_text' => __('<i class="fa fa-angle-double-right"></i>', 'rubel_miah')
 ));

 $pagination = "<ul class=\"pagination\">\n\t<li>";
 $pagination .= join("</li>\n\t<li>", $items);
 $pagination . "</li>\n</ul>\n";

 echo $pagination;
 }
 return;
 }
 }

Leave a Reply