Guest User

Untitled

a guest
May 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. code.......
  2.  
  3. <?php kriesi_pagination($the_query->max_num_pages);?>
  4.  
  5. function kriesi_pagination($pages = '', $range = 2)
  6. {
  7. $showitems = ($range * 2)+1;
  8.  
  9. global $paged;
  10. if(empty($paged)) $paged = 1;
  11.  
  12. if($pages == '')
  13. {
  14. global $wp_query;
  15. $pages = $wp_query->max_num_pages;
  16. if(!$pages)
  17. {
  18. $pages = 1;
  19. }
  20. }
  21.  
  22. if(1 != $pages)
  23. {
  24. echo "<div class='pagination'>";
  25. if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>&laquo;</a>";
  26. if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo;</a>";
  27.  
  28. for ($i=1; $i <= $pages; $i++)
  29. {
  30. if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
  31. {
  32. echo ($paged == $i)? "<span class='current'>".$i."</span>":"<a href='".get_pagenum_link($i)."' class='inactive' >".$i."</a>";
  33. }
  34. }
  35.  
  36. if ($paged < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($paged + 1)."'>&rsaquo;</a>";
  37. if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>&raquo;</a>";
  38. echo "</div>n";
  39. }
  40. }
Add Comment
Please, Sign In to add comment