-
Notifications
You must be signed in to change notification settings - Fork 23
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/164: Show pagination when Sort by Order is clicked #165
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this does appear to fix the pagination issue, what I'm seeing is it will no longer show the page heirarchy. For instance, if I have a parent page with multiple child pages, on the main list view, those are shown as nested beneath the parent. If I click on Sort by order
prior to this fix, that nesting is still shown, though pagination doesn't show. With the changes in this PR, if I click on Sort by order
, pagination now shows but the nesting heirarchy is lost
@dkotter that's a good catch. I took an alternative approach and tested it with child, as well as child of child elements. Can you take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will affect all queries on the page, not just the main query for the list table.
It's probably going to need:
if ( ! $query->is_main_query() ) {
return;
}
simple-page-ordering.php
Outdated
* @param WP_Query $query The WP_Query instance (passed by reference). | ||
*/ | ||
public static function filter_query( $query ) { | ||
$is_simple_page_ordering = isset( $_GET['id'] ) ? 'simple-page-ordering' === sanitize_text_field( wp_unslash( $_GET['id'] ) ) : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to sanitize or unslash when comparing to a string that requires neither.
$is_simple_page_ordering = isset( $_GET['id'] ) ? 'simple-page-ordering' === sanitize_text_field( wp_unslash( $_GET['id'] ) ) : false; | |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
$is_simple_page_ordering = isset( $_GET['id'] ) ? 'simple-page-ordering' === $_GET['id'] : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and passes manual testing.
The E2E tests failed on the first run but it appears to have been a glitch as they passed on the second run.
Closes #164
Description of the Change
In this PR, we additionally send
posts_per_page
as-1
when "Sort By Order" is clicked to enable pagination.How to test the Change
Changelog Entry
Credits
Props @tlovett1 @dkotter @Sidsector9
Checklist: