fix/164: Show pagination when Sort by Order is clicked#165
fix/164: Show pagination when Sort by Order is clicked#165Sidsector9 merged 5 commits intodevelopfrom
Conversation
dkotter
left a comment
There was a problem hiding this comment.
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? |
peterwilsoncc
left a comment
There was a problem hiding this comment.
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.
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; |
peterwilsoncc
left a comment
There was a problem hiding this comment.
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_pageas-1when "Sort By Order" is clicked to enable pagination.How to test the Change
Changelog Entry
Credits
Props @tlovett1 @dkotter @Sidsector9
Checklist: