diff --git a/global-templates/.DS_Store b/global-templates/.DS_Store
new file mode 100644
index 0000000..19b11fb
Binary files /dev/null and b/global-templates/.DS_Store differ
diff --git a/global-templates/pagination.php b/global-templates/pagination.php
deleted file mode 100644
index e45049a..0000000
--- a/global-templates/pagination.php
+++ /dev/null
@@ -1,97 +0,0 @@
-max_num_pages <= 1 ) {
- return;
- }
-
- $paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
- $max = intval( $wp_query->max_num_pages );
-
- /** Add current page to the array */
- if ( $paged >= 1 ) {
- $links[] = $paged;
- }
-
- /** Add the pages around the current page to the array */
- if ( $paged >= 3 ) {
- $links[] = $paged - 1;
- $links[] = $paged - 2;
- }
-
- if ( ( $paged + 2 ) <= $max ) {
- $links[] = $paged + 2;
- $links[] = $paged + 1;
- }
-
- echo '' . "\n";
-}
diff --git a/inc/pagination.php b/inc/pagination.php
index cf07258..8874fed 100644
--- a/inc/pagination.php
+++ b/inc/pagination.php
@@ -5,89 +5,54 @@
* @package understrap
*/
-/**
- * Custom Pagination with numbers
- * Credits to http://www.wpbeginner.com/wp-themes/how-to-add-numeric-pagination-in-your-wordpress-theme/
- */
+ if ( ! function_exists( 'understrap_pagination' ) ) :
+ function understrap_pagination($args = [], $class = 'pagination') {
-if ( ! function_exists( 'understrap_pagination' ) ) :
-function understrap_pagination() {
- if ( is_singular() ) {
- return;
- }
+ if ($GLOBALS['wp_query']->max_num_pages <= 1) return;
- global $wp_query;
+ $args = wp_parse_args( $args, [
+ 'mid_size' => 2,
+ 'prev_next' => false,
+ 'prev_text' => __('«', 'understrap'),
+ 'next_text' => __('»', 'understrap'),
+ 'screen_reader_text' => __('Posts navigation', 'understrap'),
+ 'type' => 'array',
+ 'current' => max( 1, get_query_var('paged') ),
+ ]);
- /** Stop execution if there's only 1 page */
- if ( $wp_query->max_num_pages <= 1 ) {
- return;
- }
+ $links = paginate_links($args);
+ $next_link = get_next_posts_page_link();
+ $prev_link = get_previous_posts_page_link();
- $paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
- $max = intval( $wp_query->max_num_pages );
+ ?>
- /** Add current page to the array */
- if ( $paged >= 1 ) {
- $links[] = $paged;
- }
+
+