1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
<?php
/**
* Pagination layout.
*
* @package understrap
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! function_exists ( 'understrap_pagination' ) ) {
function understrap_pagination( $args = array(), $class = 'pagination' ) {
if ($GLOBALS['wp_query']->max_num_pages <= 1) return;
$args = wp_parse_args( $args, array(
'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);
?>
<nav aria-label="<?php echo $args['screen_reader_text']; ?>">
<ul class="pagination">
<?php
foreach ( $links as $key => $link ) { ?>
<li class="page-item <?php echo strpos( $link, 'current' ) ? 'active' : '' ?>">
<?php echo str_replace( 'page-numbers', 'page-link', $link ); ?>
</li>
<?php } ?>
</ul>
</nav>
<?php
}
}
?>
|