Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WC pagination.php #663

Merged
merged 1 commit into from
Jan 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 44 additions & 6 deletions woocommerce/loop/pagination.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* Pagination - Show numbered pagination for catalog pages
*
Expand All @@ -11,7 +10,7 @@
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @see https://docs.woocommerce.com/document/template-structure/
* @see https://woo.com/document/template-structure/
* @package WooCommerce\Templates
* @version 3.3.1
*/
Expand All @@ -29,7 +28,46 @@
return;
}
?>
<!-- Pagination -->
<div>
<?php bootscore_pagination(); ?>
</div>
<nav aria-label="wc-navigation">
<?php
$paginate_links = paginate_links(
apply_filters(
'woocommerce_pagination_args',
array(
'base' => $base,
'format' => $format,
'add_args' => false,
'current' => max(1, $current),
'total' => $total,
'prev_text' => '&laquo;',
'next_text' => '&raquo;',
'type' => 'array',
'end_size' => 1,
'mid_size' => 1,
)
)
);

if (is_array($paginate_links)) {
?>
<ul class="pagination justify-content-center">
<?php
foreach ($paginate_links as $paginate_link) {
// Replace 'page-numbers' with 'page-link' and 'current' with 'active'.
$paginate_link = str_replace(array('page-numbers', 'current'), array('page-link', 'active'), $paginate_link);
?>

<li class="page-item">
<?php
echo wp_kses_post($paginate_link);
?>
</li>

<?php
}
?>
</ul>
<?php
}
?>
</nav>