From 11b9bf360480fa04d66df8fe59eee0fba08821da Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Sat, 2 Nov 2019 13:26:22 -0500 Subject: [PATCH] Pledge List: Sort randomly by default for fairness. See #70 --- plugins/wporg-5ftf/includes/pledge.php | 7 +++++++ themes/wporg-5ftf/archive-5ftf_pledge.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/wporg-5ftf/includes/pledge.php b/plugins/wporg-5ftf/includes/pledge.php index 9fd853b..86c3e3e 100755 --- a/plugins/wporg-5ftf/includes/pledge.php +++ b/plugins/wporg-5ftf/includes/pledge.php @@ -260,6 +260,13 @@ function filter_query( $query ) { $query->set( 'orderby', 'meta_value_num' ); $query->set( 'order', 'DESC' ); break; + + default: + $query->set( 'orderby', 'rand' ); + break; } } + + // todo remove this when `rand` pagination fixed, see https://github.com/WordPress/five-for-the-future/issues/70#issuecomment-549066883 + $query->set( 'posts_per_page', 100 ); } diff --git a/themes/wporg-5ftf/archive-5ftf_pledge.php b/themes/wporg-5ftf/archive-5ftf_pledge.php index 2f76727..05b1765 100644 --- a/themes/wporg-5ftf/archive-5ftf_pledge.php +++ b/themes/wporg-5ftf/archive-5ftf_pledge.php @@ -32,7 +32,7 @@ get_header(); ?>