Skip to content

Commit 2f1f202

Browse files
committed
Twenty Twenty: Fix post navigation to respect sort order.
Change the labels on post navigation links when the sort order is changed so the labels accurately reflect the target entries. Previously, if the sort order was reversed, 'Older' or 'Previous' links would navigate to newer entries and 'Newer' or 'Next' links would navigate to older entries. Props jikamens, dancameron, obenland, shrey0shrivastava, sirlouen, sabernhardt, shailu25, joedolson. See #10219. git-svn-id: https://develop.svn.wordpress.org/trunk@61092 602fd350-edb4-49c9-b593-d223f7449a82
1 parent c726a26 commit 2f1f202

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/wp-content/themes/twentytwenty/template-parts/pagination.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,28 @@
99
* @since Twenty Twenty 1.0
1010
*/
1111

12+
$order = get_query_var( 'order', 'DESC' );
13+
14+
/*
15+
* Translators: This text contains HTML to allow the text to be shorter on small screens.
16+
* The text inside the span with the class nav-short will be hidden on small screens.
17+
*/
18+
$new_posts_text = __( 'Newer <span class="nav-short">Posts</span>', 'twentytwenty' );
19+
20+
/*
21+
* Translators: This text contains HTML to allow the text to be shorter on small screens.
22+
* The text inside the span with the class nav-short will be hidden on small screens.
23+
*/
24+
$old_posts_text = __( 'Older <span class="nav-short">Posts</span>', 'twentytwenty' );
25+
1226
$prev_text = sprintf(
1327
'%s <span class="nav-prev-text">%s</span>',
1428
'<span aria-hidden="true">&larr;</span>',
15-
/*
16-
* Translators: This text contains HTML to allow the text to be shorter on small screens.
17-
* The text inside the span with the class nav-short will be hidden on small screens.
18-
*/
19-
__( 'Newer <span class="nav-short">Posts</span>', 'twentytwenty' )
29+
( 'DESC' === $order ) ? $new_posts_text : $old_posts_text
2030
);
2131
$next_text = sprintf(
2232
'<span class="nav-next-text">%s</span> %s',
23-
/*
24-
* Translators: This text contains HTML to allow the text to be shorter on small screens.
25-
* The text inside the span with the class nav-short will be hidden on small screens.
26-
*/
27-
__( 'Older <span class="nav-short">Posts</span>', 'twentytwenty' ),
33+
( 'DESC' === $order ) ? $old_posts_text : $new_posts_text,
2834
'<span aria-hidden="true">&rarr;</span>'
2935
);
3036

0 commit comments

Comments
 (0)