Need help with my Pagination code
-
Hi, I am having trouble getting my pagination code to work. It properly lists the pages (1,2,3,4 Next) but the “Next” link is always page 2. It appears the $paged variable is always 1
<?php $num_of_pages = ($post_count / $posts_per_page); //$link_number = 0; if($num_of_pages > 1):?> <?php global $paged; if(empty($paged)) $paged = 1; ?> <div class="pagination2"> <ul class="clear1"> <?php if( ($paged <= $num_of_pages) && ($paged > 1) ): ?> <li><a href="/library/blog/?paged=<?php echo $paged-1; ?>">Previous</a></li> <?php endif; ?> <li<?php if($paged==1) {echo ' class="current"';}?>><a href="/library/blog/?paged=1">1</a></li> <?php for ($i = 1; $i < $num_of_pages; $i++): ?> <li<?php if($paged==($i+1)) {echo ' class="current"';}?>><a href="/library/blog/?paged=<?php echo $i+1; ?>"><?php echo $i+1; ?></a></li> <?php endfor; ?> <?php if( $paged < $num_of_pages ): ?> <li><a href="/library/blog/?paged=<?php echo $paged+1; ?>">Next</a></li> <?php endif; ?> </ul> </div> <?php endif; ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Need help with my Pagination code’ is closed to new replies.