mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-18 17:33:43 +03:00
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
This commit is contained in:
parent
183f7a95bc
commit
a70212bc22
|
@ -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)" );
|
||||
|
|
|
@ -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