Mad/data archive bug#74
Open
mariel-delagarza wants to merge 3 commits intomainfrom
Open
Conversation
Add a new wp_query to the archive-data file, replace archive-data content with old content that had been moved to dataTables-archive-data. The dataTables default for pagination is true, but forcing it by declaring "paging": "true" helped fix the bug.
aerospace_post_sum is used to display "Page X/Y" at the top and bottom of the page. You can see it also used in the other archives (e.g. Aerospace 101). Because the data for the table is fetched in advanced, pagination through dataTables.js is not a true page refresh, so the aerospace_post_sum doesn't get triggered and "PAGE 1/2" does not update to "PAGE 2/2" when the user goes to the second page of the table.
With other updates, file doesn't need to have "paging" set to true in order to function properly. The default for dataTables pagination is already true.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Fixing bug from #73
The default limit for number of posts per page is 10, and WordPress will fetch additional posts upon the user clicking the "next" pagination button. This is the pagination used on the temporary fix table.
dataTables.jswasn't able to paginate because WordPress was only grabbing ten posts at a time.Fix
Replace
archive-datawith content that had been moved todataTable-archive-data.Copy content from old file and replace content of the temporary fix in
archive-data.Add new
wp_queryto the archive-data file.To fix the bug caused by WordPress not fetching all posts at once, create a new
wp_queryasking for all posts of typedataand set-1(no limit) forposts_per_page. Save this as$resultand use this query in the if/while statements that create the table.Remove
aerospace_post_num()usage.Other archives use this function to render "PAGE X/Y" at the top and bottom of their pages. Because the data for this table is now fetched in advance, going to the next page of the table doesn't trigger a page re-render so the "PAGE 1/2" never updates to "PAGE 2/2". While php is removed, leave the
divs in place so the styling isn't affected.Video
Zoomed way out so it would fit on one screen without scrolling:
Screen.Recording.2022-06-14.at.3.54.00.PM.mov