-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Twenty Ten: fix "Older posts" and "Newer posts" links for archive pages when in ascending order #10359
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
Closed
Closed
Twenty Ten: fix "Older posts" and "Newer posts" links for archive pages when in ascending order #10359
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f73edc8
Check query order in loop.php
sabernhardt d83213d
Coding standards fix
sabernhardt 5209dc0
Add missing checks for `$prev_link` and `$next_link`
sabernhardt b7a04a5
Remove `$order` variable
sabernhardt 42e9968
Merge branch 'WordPress:trunk' into t10-older-newer-posts
sabernhardt 660b000
Remove `wp_kses_post`
sabernhardt a81dbff
Remove `$order` variable
sabernhardt 1532689
Revert "Remove `$order` variable"
sabernhardt adb06d6
Reapply "Remove `$order` variable"
sabernhardt d463e44
Remove additional `wp_kses_post`
sabernhardt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,10 +20,25 @@ | |
| ?> | ||
|
|
||
| <?php // Display navigation to next/previous pages when applicable. ?> | ||
| <?php if ( $wp_query->max_num_pages > 1 ) : ?> | ||
| <?php | ||
| if ( $wp_query->max_num_pages > 1 ) : | ||
| $order = get_query_var( 'order', 'DESC' ); | ||
| $is_desc = ( 'DESC' === $order ); | ||
|
|
||
| $new_posts_text = __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ); | ||
| $old_posts_text = __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ); | ||
|
|
||
| $prev_link = $is_desc ? get_next_posts_link( $old_posts_text ) : get_previous_posts_link( $old_posts_text ); | ||
| $next_link = $is_desc ? get_previous_posts_link( $new_posts_text ) : get_next_posts_link( $new_posts_text ); | ||
| ?> | ||
| <div id="nav-above" class="navigation"> | ||
| <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div> | ||
| <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div> | ||
| <?php if ( $prev_link ) : ?> | ||
| <div class="nav-previous"><?php echo wp_kses_post( $prev_link ); ?></div> | ||
sabernhardt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <?php endif; ?> | ||
|
|
||
| <?php if ( $next_link ) : ?> | ||
| <div class="nav-next"><?php echo wp_kses_post( $next_link ); ?></div> | ||
| <?php endif; ?> | ||
| </div><!-- #nav-above --> | ||
| <?php endif; ?> | ||
|
|
||
|
|
@@ -205,7 +220,12 @@ | |
| <?php // Display navigation to next/previous pages when applicable. ?> | ||
| <?php if ( $wp_query->max_num_pages > 1 ) : ?> | ||
| <div id="nav-below" class="navigation"> | ||
| <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div> | ||
| <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div> | ||
| <?php if ( $prev_link ) : ?> | ||
| <div class="nav-previous"><?php echo wp_kses_post( $prev_link ); ?></div> | ||
|
||
| <?php endif; ?> | ||
|
|
||
| <?php if ( $next_link ) : ?> | ||
| <div class="nav-next"><?php echo wp_kses_post( $next_link ); ?></div> | ||
| <?php endif; ?> | ||
| </div><!-- #nav-below --> | ||
| <?php endif; ?> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.