Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. /**
  2. * Custom pagination function
  3. *
  4. * Illdy 1.09
  5. */
  6.  
  7. function pagination_output() {
  8.  
  9. $prev_arrow = is_rtl() ? '&rarr;' : '<i class="fa fa-angle-left"></i>';
  10. $next_arrow = is_rtl() ? '&larr;' : '<i class="fa fa-angle-right"></i>';
  11.  
  12. global $wp_query;
  13. $total = $wp_query->max_num_pages;
  14. $big = 999999999; // need an unlikely integer
  15. if( $total > 1 ) {
  16. if( !$current_page = get_query_var('paged') )
  17. $current_page = 1;
  18. if( get_option('permalink_structure') ) {
  19. $format = 'page/%#%/';
  20. } else {
  21. $format = '&paged=%#%';
  22. }
  23.  
  24. echo '<nav class="paginate-links">';
  25. echo paginate_links(array(
  26. 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
  27. 'format' => $format,
  28. 'current' => max( 1, get_query_var('paged') ),
  29. 'total' => $total,
  30. 'mid_size' => 3,
  31. 'type' => 'plain',
  32. 'prev_text' => $prev_arrow,
  33. 'next_text' => $next_arrow,
  34. ) );
  35. echo '</nav><!--/.paginate-links-->';
  36.  
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement