Advertisement
Guest User

functions.php

a guest
Sep 25th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. function pagination_funtion() {
  2.  
  3. global $wp_query;
  4.  
  5. $total = $wp_query->max_num_pages;
  6.  
  7. if ( $total > 1 ) {
  8.  
  9. if ( !$current_page = get_query_var(‘paged’) )
  10.  
  11. $current_page = 1;
  12.  
  13. $big = 999999999;
  14.  
  15. $permalink_structure = get_option(‘permalink_structure’);
  16.  
  17. $format = empty( $permalink_structure ) ? ‘&page=%#%’ : ‘page/%#%/’;
  18.  
  19. echo paginate_links(array(
  20.  
  21. ‘base’ => str_replace( $big,%#%’, get_pagenum_link( $big ) ),
  22.  
  23. ‘format’ => $format,
  24.  
  25. current=> $current_page,
  26.  
  27. ‘total’ => $total,
  28.  
  29. ‘mid_size’ => 4,
  30.  
  31. ‘type’ => ‘plain’
  32.  
  33. ));
  34.  
  35. }
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement