Skip to content

Commit fb1b052

Browse files
authored
Merge pull request #564 from devgeniem/TMS-1263
TMS-1263: Fix pagination from showing arrow button on last page
2 parents 793b911 + aa4653e commit fb1b052

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

CHANGELOG.MD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
- TMS-1263: Fix pagination from showing arrow button on last page
11+
1012
## [1.71.3] - 2026-03-16
1113

1214
- TMS-1259: Disable link underline in theme.json

lib/DustPressController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ protected function alter_pagination_data( $data ) : object {
5757
$data->hellip_end = false;
5858
}
5959

60+
// Remove next_page if already on the last page.
61+
if ( ! empty( $data->on_last_page ) ) {
62+
$data->next_page = null;
63+
}
64+
6065
$data->S->page_aria_label = _x( 'Go to Page', 'pagination', 'tms-theme-base' ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
6166
$data->S->next = _x( 'Next', 'pagination', 'tms-theme-base' ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
6267
$data->S->prev = _x( 'Previous', 'pagination', 'tms-theme-base' ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase

partials/ui/pagination.dust

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<ul class="pagination is-flex is-flex-wrap-wrap is-flex-direction-row is-justify-content-center">
44
{?prev_page}
55
<li class="arrow arrow-left">
6-
<a class="paginate" href="{page_link}{prev_page}{hash}" data-page="{prev_page}">
6+
<a class="paginate" href="{page_link|url}{prev_page|attr}{hash|attr}" data-page="{prev_page|attr}">
77
{>"ui/icon" icon="chevron-left" class="icon--medium" aria-hidden="true" /}
8-
<span class="is-sr-only">{S.prev}</span>
8+
<span class="is-sr-only">{S.prev|html}</span>
99
</a>
1010
</li>
1111
{/prev_page}
1212
{?hellip_start}
1313
<li class="pagination-item">
14-
<a class="pagination-item__link" href="{page_link}1{hash}" data-page="{first_page}">{first_page}</a>
14+
<a class="pagination-item__link" href="{page_link|url}1{hash|attr}" data-page="{first_page|attr}">{first_page|html}</a>
1515
</li>
1616

1717
<li class="unavailable" aria-disabled="true">
@@ -20,11 +20,11 @@
2020
{/hellip_start}
2121
{#pages}
2222
<li class="pagination-item{?active} is-current unavailable{/active}">
23-
<a class="pagination-item__link{^active} clickable{/active}" href="{page_link}{page}{hash}"
23+
<a class="pagination-item__link{^active} clickable{/active}" href="{page_link|url}{page|attr}{hash|attr}"
2424
{?active}aria-current="true" {/active}
25-
aria-label="{S.page_aria_label|s} {page}"
26-
data-page="{page}">
27-
{page}
25+
aria-label="{S.page_aria_label|attr} {page|attr}"
26+
data-page="{page|attr}">
27+
{page|html}
2828
</a>
2929
</li>
3030
{/pages}
@@ -34,15 +34,15 @@
3434
</li>
3535

3636
<li class="pagination-item">
37-
<a class="pagination-item__link" href="{page_link}{last_page}{hash}" data-page="{last_page}">
38-
{last_page}
37+
<a class="pagination-item__link" href="{page_link|url}{last_page|attr}{hash|attr}" data-page="{last_page|attr}">
38+
{last_page|html}
3939
</a>
4040
</li>
4141
{/hellip_end}
4242
{?next_page}
4343
<li class="arrow arrow-right">
44-
<a class="paginate" href="{page_link}{next_page}{hash}" data-page="{next_page}">
45-
<span class="is-sr-only">{S.next}</span>
44+
<a class="paginate" href="{page_link|url}{next_page|attr}{hash|attr}" data-page="{next_page|attr}">
45+
<span class="is-sr-only">{S.next|html}</span>
4646
{>"ui/icon" icon="chevron-right" class="icon--medium" aria-hidden="true" /}
4747
</a>
4848
</li>

0 commit comments

Comments
 (0)