Fix indentation & space usage

This commit is contained in:
IanDelMar 2018-11-19 00:37:12 +01:00
parent 024ddea2ab
commit ee459e936b
1 changed files with 33 additions and 30 deletions

View File

@ -9,48 +9,51 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly. exit; // Exit if accessed directly.
} }
if ( ! function_exists ( 'understrap_pagination' ) ) { if ( ! function_exists( 'understrap_pagination' ) ) {
function understrap_pagination( $args = array(), $class = 'pagination' ) { function understrap_pagination( $args = array(), $class = 'pagination' ) {
if ($GLOBALS['wp_query']->max_num_pages <= 1) return; if ( $GLOBALS['wp_query']->max_num_pages <= 1 ) {
return;
}
$args = wp_parse_args( $args, array( $args = wp_parse_args(
'mid_size' => 2, $args,
'prev_next' => true, array(
'prev_text' => __('&laquo;', 'understrap'), 'mid_size' => 2,
'next_text' => __('&raquo;', 'understrap'), 'prev_next' => true,
'screen_reader_text' => __('Posts navigation', 'understrap'), 'prev_text' => __( '&laquo;', 'understrap' ),
'type' => 'array', 'next_text' => __( '&raquo;', 'understrap' ),
'current' => max( 1, get_query_var('paged') ), 'screen_reader_text' => __( 'Posts navigation', 'understrap' ),
) ); 'type' => 'array',
'current' => max( 1, get_query_var( 'paged' ) ),
)
);
$links = paginate_links($args); $links = paginate_links( $args );
?> ?>
<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
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
}
?>
foreach ( $links as $key => $link ) { ?> </ul>
<li class="page-item <?php echo strpos( $link, 'current' ) ? 'active' : '' ?>"> </nav>
<?php echo str_replace( 'page-numbers', 'page-link', $link ); ?> <?php
}
</li>
<?php } ?>
</ul>
</nav>
<?php
}
} }
?> ?>