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' ) ) {
|
||||
|
||||
function understrap_pagination($args = [], $class = 'pagination') {
|
||||
|
||||
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']; ?>">
|
||||
|
||||
<ul class="pagination">
|
||||
|
||||
<?php
|
||||
$i = 1;
|
||||
foreach ( $links as $link ) { ?>
|
||||
<li class="page-item <?php if ($i == $args['current']) { echo 'active'; }; ?>">
|
||||
|
||||
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 $i++;} ?>
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Reference in New Issue