Update pagination.php
1. Dynamic prev and next 1. Improved active class 1. Improved ellipsis
This commit is contained in:
parent
e59538ad22
commit
f8dd00d1c4
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! function_exists ( 'understrap_pagination' ) ) {
|
if ( ! function_exists ( 'understrap_pagination' ) ) {
|
||||||
|
|
||||||
function understrap_pagination($args = [], $class = 'pagination') {
|
function understrap_pagination($args = [], $class = 'pagination') {
|
||||||
|
|
||||||
if ($GLOBALS['wp_query']->max_num_pages <= 1) return;
|
if ($GLOBALS['wp_query']->max_num_pages <= 1) return;
|
||||||
|
@ -25,19 +26,27 @@ if ( ! function_exists ( 'understrap_pagination' ) ) {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<nav aria-label="<?php echo $args['screen_reader_text']; ?>">
|
<nav aria-label="<?php echo $args['screen_reader_text']; ?>">
|
||||||
|
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$i = 1;
|
|
||||||
foreach ( $links as $link ) { ?>
|
foreach ( $links as $key => $link ) { ?>
|
||||||
<li class="page-item <?php if ($i == $args['current']) { echo 'active'; }; ?>">
|
|
||||||
|
<li class="page-item <?php echo strpos( $link, 'current' ) ? 'active' : '' ?>">
|
||||||
|
|
||||||
<?php echo str_replace( 'page-numbers', 'page-link', $link ); ?>
|
<?php echo str_replace( 'page-numbers', 'page-link', $link ); ?>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<?php $i++;} ?>
|
<?php } ?>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
Reference in New Issue