Guest User

Untitled

a guest
Apr 24th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. function custom_pagination($pages = '', $range = 1)
  2. {
  3. global $wp_query, $wp_rewrite, $_GET;
  4. $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
  5. $pagerange = 1;
  6. $pagination = array(
  7. 'base' => @add_query_arg('page','%#%'),
  8. 'format' => '',
  9. 'total' => $wp_query->max_num_pages,
  10. 'current' => $current,
  11. 'show_all' => false,
  12. 'mid_size' => 2,
  13. 'prev_next' => false,
  14. 'prev_text' => __('') ,
  15. 'next_text' => __(''),
  16. 'type' => 'plain'
  17. );
  18. if ( $wp_rewrite->using_permalinks() ) {
  19. $url = get_pagenum_link( 1 );
  20. foreach ( $_GET as $k => $v ) {
  21. $url = remove_query_arg( $k, $url );
  22. }
  23. $pagination['base'] = user_trailingslashit( trailingslashit( $url ) . 'page/%#%/', 'paged' );
  24. }
  25. if ( count($_GET) > 0 ) {
  26. foreach ( $_GET as $k => $v ) {
  27. $args[$k] = $v;
  28. }
  29. $pagination['add_args'] = $args;
  30. }
  31. echo '<div class="col-12 col-sm-8 numbers d-flex justify-content-center align-items-center">'.paginate_links( $pagination ).'</div>';
  32. }
Add Comment
Please, Sign In to add comment