Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function custom_pagination($pages = '', $range = 1)
- {
- global $wp_query, $wp_rewrite, $_GET;
- $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
- $pagerange = 1;
- $pagination = array(
- 'base' => @add_query_arg('page','%#%'),
- 'format' => '',
- 'total' => $wp_query->max_num_pages,
- 'current' => $current,
- 'show_all' => false,
- 'mid_size' => 2,
- 'prev_next' => false,
- 'prev_text' => __('') ,
- 'next_text' => __(''),
- 'type' => 'plain'
- );
- if ( $wp_rewrite->using_permalinks() ) {
- $url = get_pagenum_link( 1 );
- foreach ( $_GET as $k => $v ) {
- $url = remove_query_arg( $k, $url );
- }
- $pagination['base'] = user_trailingslashit( trailingslashit( $url ) . 'page/%#%/', 'paged' );
- }
- if ( count($_GET) > 0 ) {
- foreach ( $_GET as $k => $v ) {
- $args[$k] = $v;
- }
- $pagination['add_args'] = $args;
- }
- echo '<div class="col-12 col-sm-8 numbers d-flex justify-content-center align-items-center">'.paginate_links( $pagination ).'</div>';
- }
Add Comment
Please, Sign In to add comment