mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-01 16:51:18 +03:00
Pledge List: Add sorting by total contributor count
Allow sorting the pledge archive by total number of confirmed contributors.
This commit is contained in:
parent
e9aeb72c9b
commit
fea1621cf9
|
@ -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;
|
||||
|
|
|
@ -37,6 +37,9 @@ get_header(); ?>
|
|||
<option value="alphabetical" <?php selected( $pledge_order, 'alphabetical' ); ?>>
|
||||
<?php esc_html_e( 'Alphabetical', 'wporg-5ftf' ); ?>
|
||||
</option>
|
||||
<option value="contributors" <?php selected( $pledge_order, 'contributors' ); ?>>
|
||||
<?php esc_html_e( 'Total Contributors', 'wporg-5ftf' ); ?>
|
||||
</option>
|
||||
<option value="hours" <?php selected( $pledge_order, 'hours' ); ?>>
|
||||
<?php esc_html_e( 'Total Hours', 'wporg-5ftf' ); ?>
|
||||
</option>
|
||||
|
|
Loading…
Reference in a new issue