From fea1621cf9bd9c5b49772a5104c5233067120afd Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Wed, 11 Dec 2019 16:41:36 -0500 Subject: [PATCH] Pledge List: Add sorting by total contributor count Allow sorting the pledge archive by total number of confirmed contributors. --- 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 fb6f178..4542fc6 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: $query->set( 'orderby', 'rand' ); break; 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(); ?> +