From a70212bc2275240ff5f317ee5d6f9b9d47d04f3a Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Mon, 16 Dec 2019 17:48:33 -0500 Subject: [PATCH] Pledge List: Add sorting by total contributor count (#133) Add a "Total Contributors" option to the sorting menu on the pledge list. This will sort the list from most confirmed contributors to least. Fixes #94 --- plugins/wporg-5ftf/includes/pledge.php | 6 ++++++ themes/wporg-5ftf/archive-5ftf_pledge.php | 3 +++ 2 files changed, 9 insertions(+) diff --git a/plugins/wporg-5ftf/includes/pledge.php b/plugins/wporg-5ftf/includes/pledge.php index 453a14e..21ed3b3 100755 --- a/plugins/wporg-5ftf/includes/pledge.php +++ b/plugins/wporg-5ftf/includes/pledge.php @@ -435,6 +435,12 @@ function filter_query( $query ) { $query->set( 'order', 'DESC' ); break; + case 'contributors': + $query->set( 'meta_key', $contributor_count_key ); + $query->set( 'orderby', 'meta_value_num' ); + $query->set( 'order', 'DESC' ); + break; + default: $date = date( 'YmdH' ); $query->set( 'orderby', "RAND($date)" ); diff --git a/themes/wporg-5ftf/archive-5ftf_pledge.php b/themes/wporg-5ftf/archive-5ftf_pledge.php index ec27fac..1b9db42 100644 --- a/themes/wporg-5ftf/archive-5ftf_pledge.php +++ b/themes/wporg-5ftf/archive-5ftf_pledge.php @@ -37,6 +37,9 @@ get_header(); ?> +