From f8dd00d1c430986e42afbd4e61becc1071674854 Mon Sep 17 00:00:00 2001 From: Johan Nielsen Date: Fri, 11 May 2018 21:28:07 +0200 Subject: [PATCH] Update pagination.php 1. Dynamic prev and next 1. Improved active class 1. Improved ellipsis --- inc/pagination.php | 63 ++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/inc/pagination.php b/inc/pagination.php index 77c2b9b..6ed13e4 100644 --- a/inc/pagination.php +++ b/inc/pagination.php @@ -6,38 +6,47 @@ */ if ( ! function_exists ( 'understrap_pagination' ) ) { - function understrap_pagination($args = [], $class = 'pagination') { - if ($GLOBALS['wp_query']->max_num_pages <= 1) return; + function understrap_pagination($args = [], $class = 'pagination') { - $args = wp_parse_args( $args, [ - 'mid_size' => 2, - 'prev_next' => true, - 'prev_text' => __('«', 'understrap'), - 'next_text' => __('»', 'understrap'), - 'screen_reader_text' => __('Posts navigation', 'understrap'), - 'type' => 'array', - 'current' => max( 1, get_query_var('paged') ), - ]); + if ($GLOBALS['wp_query']->max_num_pages <= 1) return; - $links = paginate_links($args); + $args = wp_parse_args( $args, [ + 'mid_size' => 2, + 'prev_next' => true, + 'prev_text' => __('«', 'understrap'), + 'next_text' => __('»', 'understrap'), + 'screen_reader_text' => __('Posts navigation', 'understrap'), + 'type' => 'array', + 'current' => max( 1, get_query_var('paged') ), + ]); - ?> + $links = paginate_links($args); - - + + $link ) { ?> + +
  • + + + +
  • + + + + + + + +