mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-02 09:11:17 +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' );
|
$query->set( 'order', 'DESC' );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'contributors':
|
||||||
|
$query->set( 'meta_key', $contributor_count_key );
|
||||||
|
$query->set( 'orderby', 'meta_value_num' );
|
||||||
|
$query->set( 'order', 'DESC' );
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$query->set( 'orderby', 'rand' );
|
$query->set( 'orderby', 'rand' );
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -37,6 +37,9 @@ get_header(); ?>
|
||||||
<option value="alphabetical" <?php selected( $pledge_order, 'alphabetical' ); ?>>
|
<option value="alphabetical" <?php selected( $pledge_order, 'alphabetical' ); ?>>
|
||||||
<?php esc_html_e( 'Alphabetical', 'wporg-5ftf' ); ?>
|
<?php esc_html_e( 'Alphabetical', 'wporg-5ftf' ); ?>
|
||||||
</option>
|
</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' ); ?>>
|
<option value="hours" <?php selected( $pledge_order, 'hours' ); ?>>
|
||||||
<?php esc_html_e( 'Total Hours', 'wporg-5ftf' ); ?>
|
<?php esc_html_e( 'Total Hours', 'wporg-5ftf' ); ?>
|
||||||
</option>
|
</option>
|
||||||
|
|
Loading…
Reference in a new issue