diff --git a/global-templates/pagination.php b/global-templates/pagination.php new file mode 100644 index 0000000..4dc38e2 --- /dev/null +++ b/global-templates/pagination.php @@ -0,0 +1,89 @@ +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/home.php b/home.php index e17080f..5882d5f 100644 --- a/home.php +++ b/home.php @@ -79,7 +79,9 @@ if ( is_front_page() && is_home() ) { - +