wordpress - Pagination for single post type is not working -
i getting problem in previous next link pagination single posts. have total 12 posts , on next , previous showing 2 posts every time. code.
<?php global $wpdb; $args = array( 'category ' => $catid, 'order' => 'desc', 'posts_per_page'=>1, 'paged' => $paged ); query_posts($args); $total_posts = (int) $wp_query->found_posts; $prev_post = get_previous_post(); $previd = $prev_post->id ; $next_post = get_next_post(); $nextid = $next_post->id ; $all_posts = $all_post_query->post_count; ?> <div class="paginate"> <?php $prev_post = get_previous_post(); if (!empty( $prev_post )) { echo '<span class="glyphicon-chevron-left">'; previous_post('%',' previous', 'no'); echo '</span>'; ?> <?php } else { ?> <?php echo 'previous'; } ;?> <?php if(!empty($nextid)) { ?> <?php echo '<span class="glyphicon-chevron-right">'; next_post('%', 'next', 'no'); echo '</span>'; ?> <?php } else { ?> <a class="next"><?php echo 'next'; } ; ?></a> </div> </div> wordpress
No comments:
Post a Comment