From 80ab3d221b91c3151086aea937aa8bca28963839 Mon Sep 17 00:00:00 2001 From: Mariel de la Garza Date: Tue, 14 Jun 2022 15:16:52 -0400 Subject: [PATCH 1/3] Update query for 'data' posts to fix pagination bug (#73) 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. --- wp-content/themes/aerospace/archive-data.php | 108 ++++++++++++------- wp-content/themes/aerospace/js/data-repo.js | 1 + 2 files changed, 68 insertions(+), 41 deletions(-) diff --git a/wp-content/themes/aerospace/archive-data.php b/wp-content/themes/aerospace/archive-data.php index bac064dd..ab386f5a 100755 --- a/wp-content/themes/aerospace/archive-data.php +++ b/wp-content/themes/aerospace/archive-data.php @@ -7,6 +7,13 @@ * @package Aerospace */ +$args = array( + 'post_type' => 'data', + 'posts_per_page' => -1 +); + +$result = new WP_Query($args); + if ( get_archive_top_content() ) { $description = get_archive_top_content(); } else { @@ -23,56 +30,75 @@ get_header(); ?>
-
- -
- + + + + + + + + + + + + have_posts()) : $result->the_post(); + get_template_part( 'template-parts/content-data' ); + endwhile; + ?> + + +
+ - - - - - - - - - + Date: Tue, 14 Jun 2022 15:39:51 -0400 Subject: [PATCH 2/3] Remove unused references to aerospace_post_sum (#73) 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. --- wp-content/themes/aerospace/archive-data.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/wp-content/themes/aerospace/archive-data.php b/wp-content/themes/aerospace/archive-data.php index ab386f5a..aa3227dc 100755 --- a/wp-content/themes/aerospace/archive-data.php +++ b/wp-content/themes/aerospace/archive-data.php @@ -41,7 +41,6 @@
-
@@ -89,10 +88,7 @@
-
-
-
From bd2f7a4d5815285e99eeb1a2331590dbd647d2b2 Mon Sep 17 00:00:00 2001 From: Mariel de la Garza Date: Tue, 14 Jun 2022 15:49:01 -0400 Subject: [PATCH 3/3] Remove unnecessary paging setting in dataRepo.js (#73) 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. --- wp-content/themes/aerospace/js/data-repo.js | 1 - 1 file changed, 1 deletion(-) diff --git a/wp-content/themes/aerospace/js/data-repo.js b/wp-content/themes/aerospace/js/data-repo.js index 51cd9169..f01e8758 100644 --- a/wp-content/themes/aerospace/js/data-repo.js +++ b/wp-content/themes/aerospace/js/data-repo.js @@ -7,7 +7,6 @@ "info": false, "lengthChange": false, "order": [[ 2, "desc" ]], - "paging": true, "pageLength": 10, "pagingType": "simple_numbers", "language": {